首页 > 解决方案 > 如何查找弹性搜索查询的执行时间

问题描述

我正在使用弹性搜索从 Rails 应用程序中获得快速结果。我想知道执行特定查询需要多少时间?是否有任何工具可以让我找到并比较执行时间以便优化查询?

标签: elasticsearchindexingquery-optimizationkibana

解决方案


响应对象中的 'took' 属性是以毫秒为单位的执行时间。例如:

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

推荐阅读