One of most powerful features of Elasticsearch is the Query DSL (Domain specific Language) or the query language. The query language is very expressive and can be used to define filters, queries, sorting, pagination, and aggregations in the same query. To execute a search query, an HTTP request should be sent to the _search endpoint. The index and type on which the query should be executed is specified in the URL. Index and type are optional. If no index/type is specified, Elasticsearch executes the request across all the indexes in the cluster. A search query in Elasticsearch can be executed in two different ways:
- By passing the search request as query parameters.
- By passing the search request in the request body.
A simple search query using query parameters is shown here:
GET chapter6/product/_search?q=product_name:jacket
Simple queries can be executed...