In this section, we are going to learn two important features related to queries. First, the query validation, which will help you in finding out if your queries, can be executed or is bugged. Second, getting the full execution time information of a query so that you can check out which component of your query is taking how much and eventually it will help you in diagnosis of your slow queries.
While writing a new query, it's better to be sure that the query you have formed has the correct syntax and does not have any other issues such as data type conflicts with respect to any field. Elasticsearch provides a dedicated _validate
REST endpoint for validating the queries without executing them. Let's look at an example to see how to use this API.
First of all, let's create and index some sample documents inside it:
curl -XPUT "http://localhost:9200/elasticsearch_books/books/_bulk?refresh" -d' {"index":{"_id"...