Search code examples
elasticsearchindexingquery-optimizationkibana

How to find execution time of elasticsearch query


I am using elasticsearch to get the fast result from a rails app. I want to know how much time a particular query took to get executed? Is there any tool where I can find and compare execution time so that I can optimize query?


Solution

  • The 'took' attribute in the response object is the execution time in milliseconds. For example:

    {
      "took" : 17,
      "timed_out" : false,
      "_shards" : {
        "total" : 5,
        "successful" : 5,
        "skipped" : 0,
        "failed" : 0
      },
      "hits" : {
        "total" : 0,
        "max_score" : null,
        "hits" : [ ]
      }
    }