Global Search API EE with and without Elasticsearch

Description

Need a global search API similar to GitHub's

Design

  1. Add a search API endpoint (params and response schema TBD).
  2. When Elasticsearch is available, this uses it, just like the GitLab UI would:
  3. You can search globally across projects, searching blobs by filename and contents, commits by metadata, etc.
  4. You can use the same syntax we support in the UI for operators.
  5. You can scope your search to a project or group if needed.
  6. When Elasticsearch is not available (in EE or CE (separate issue https://gitlab.com/gitlab-org/gitlab-ce/issues/41763)), we provide the same features as the default search service:
  7. You can search globally or within a group for issues, MRs, comments, snippets, etc.
  8. Repository contents are only searchable within a project scope.

Previous description

Links / references

Would love a similar feature to GitHub's Search API

Documentation blurb

(Write the start of the documentation of this feature here, include:

  1. Why should someone use it?

I implement Enterprise wide capabilities that need to "look at" all public GitLab repos (projects). Example: I want to be able to scan all public GitLab projects for a package.json. If present, then I want to look for Enterprise components so I can auto generate ROI reports on our reusable components. This is easily done with GitHub. Extremely tedious with GitLab.

  1. What is the solution.

Mimic GitHub's Search API

  1. How does someone use this

See #1 (closed) above

Edited by Victor Wu