【发布时间】:2019-01-19 10:19:01
【问题描述】:
我有两个弹性搜索集群,每个集群具有相同的索引和数据。 同样的简单查询在集群 A 上需要几毫秒,但在集群 B 上需要超过 10 秒。
我使用了 _profileAPI,在集群 B 上,我可以看到 elasticsearch 在 create_weight 操作上花费了大量时间。
{
"id" : "[dj3LJZL1RNuPEP7S0ZXFVQ][index_2018_12][3]",
"searches" : [
{
"query" : [
{
"type" : "TermQuery",
"description" : "n:8096344531",
"time" : "441.2ms",
"time_in_nanos" : 441271696,
"breakdown" : {
"score" : 0,
"build_scorer_count" : 20,
"match_count" : 0,
"create_weight" : 441255457,
"next_doc" : 0,
"match" : 0,
"create_weight_count" : 1,
"next_doc_count" : 0,
"score_count" : 0,
"build_scorer" : 16218,
"advance" : 0,
"advance_count" : 0
}
}
],
"rewrite_time" : 3967,
"collector" : [
{
"name" : "CancellableCollector",
"reason" : "search_cancelled",
"time" : "79.4micros",
"time_in_nanos" : 79420,
"children" : [
{
"name" : "SimpleTopScoreDocCollector",
"reason" : "search_top_hits",
"time" : "42.1micros",
"time_in_nanos" : 42166
}
]
}
]
}
],
"aggregations" : [ ]
},
{
"id" : "[dj3LJZL1RNuPEP7S0ZXFVQ][index_2018_12][4]",
"searches" : [
{
"query" : [
{
"type" : "TermQuery",
"description" : "n:8096344531",
"time" : "296.7ms",
"time_in_nanos" : 296795143,
"breakdown" : {
"score" : 0,
"build_scorer_count" : 15,
"match_count" : 0,
"create_weight" : 296779276,
"next_doc" : 0,
"match" : 0,
"create_weight_count" : 1,
"next_doc_count" : 0,
"score_count" : 0,
"build_scorer" : 15851,
"advance" : 0,
"advance_count" : 0
}
}
],
"rewrite_time" : 2947,
"collector" : [
{
"name" : "CancellableCollector",
"reason" : "search_cancelled",
"time" : "54.7micros",
"time_in_nanos" : 54776,
"children" : [
{
"name" : "SimpleTopScoreDocCollector",
"reason" : "search_top_hits",
"time" : "18.6micros",
"time_in_nanos" : 18642
}
]
}
]
}
],
"aggregations" : [ ]
},
{
"id" : "[dj3LJZL1RNuPEP7S0ZXFVQ][index_2019_01][3]",
"searches" : [
{
"query" : [
{
"type" : "TermQuery",
"description" : "n:8096344531",
"time" : "173.2ms",
"time_in_nanos" : 173260750,
"breakdown" : {
"score" : 0,
"build_scorer_count" : 17,
"match_count" : 0,
"create_weight" : 173247380,
"next_doc" : 0,
"match" : 0,
"create_weight_count" : 1,
"next_doc_count" : 0,
"score_count" : 0,
"build_scorer" : 13352,
"advance" : 0,
"advance_count" : 0
}
}
],
"rewrite_time" : 4606,
"collector" : [
{
"name" : "CancellableCollector",
"reason" : "search_cancelled",
"time" : "47.5micros",
"time_in_nanos" : 47584,
"children" : [
{
"name" : "SimpleTopScoreDocCollector",
"reason" : "search_top_hits",
"time" : "15.8micros",
"time_in_nanos" : 15809
}
]
}
]
}
],
"aggregations" : [ ]
},
...
在集群 B 上,TermQuery 在每个分片上需要 100 毫秒到 500 毫秒,而在集群 A 上只需要几微秒
我能做些什么来解决这个问题?
【问题讨论】:
标签: elasticsearch