URI search

The URI search uses a simple query string with URL parameters to execute the Search API. We will demonstrate a number of common parameters:

  • from: The starting item (default to 0) to return in the hits field.
  • size: The number of items (default to 10) to return in the hits field.
  • sort: Sort the field (default to ascending) by specifying sort=field:asc or sort=field:desc, or by the scores (sort=_score:asc).
  • _source: Return the _source field by default. If it is set to false, no _source field is returned.

The following screenshot shows an example of using the from, size, sort, and _source parameters. The search result of the request will only have two items returned. The items returned start from index 2 after sorting the symbol ...

Get Advanced Elasticsearch 7.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.