为什么Elasticsearch中的TermQuery这么慢?

时间:2019-05-14 06:53:31

标签: elasticsearch

我一直在使用es 5.4.3进行多索引搜索。我使用配置文件API跟踪搜索过程,发现其中一个“ TermQuery”花费了160毫秒以上!我是es和lucene的新手,但我听说lucene中的termquery非常快。即使在将“ fielddata”放入内存后也会发生这种情况(我将在下面显示我的索引的设置方式),我对自己的映射不是很自信,希望我的主人能弄清楚我的错误并解决了问题。我有什么指示要弄清楚问题出在哪里吗? 该映射源自es 2.x,但官方文档表示它将自动进行转换。

new_mappings = {
        "properties": {
            "did": {"type": "long", "index": "not_analyzed"},
            "title": {"type": "string", "index": "analyzed", "fielddata": {"loading": "eager"}},
            "title_embed": {"type": "double", "index": "no"},
            "entity": {"type": "string", "index": "not_analyzed", "fielddata": {"loading": "eager"}},
            "tag": {"type": "string", "index": "not_analyzed"},
            "aliases": {"type": "string", "index": "not_analyzed"},
            "entity_with_field": {"type": "string", "index": "not_analyzed", "fielddata": {"loading": "eager"}},
            "original_title": {"type": "string", "index": "analyzed", "analyzer": "standard", "fielddata": {"loading": "eager"}},
            "did3": {"type": "string", "index": "not_analyzed"},
            "title_entity": {"type": "string", "index": "not_analyzed", "fielddata": {"loading": "eager"}},
        }
    }
              {
                "type" : "TermQuery",
                "description" : "title:cure",
                "time" : "163.5755780ms",
                "time_in_nanos" : 163575578,
                "breakdown" : {
                  "score" : 72259602,
                  "build_scorer_count" : 19,
                  "match_count" : 0,
                  "create_weight" : 35370852,
                  "next_doc" : 55374841,
                  "match" : 0,
                  "create_weight_count" : 1,
                  "next_doc_count" : 71435,
                  "score_count" : 71416,
                  "build_scorer" : 427412,
                  "advance" : 0,
                  "advance_count" : 0
                }
              },
              {
                "type" : "TermQuery",
                "description" : "title:fever",
                "time" : "0.2344140000ms",
                "time_in_nanos" : 234414,
                "breakdown" : {
                  "score" : 0,
                  "build_scorer_count" : 19,
                  "match_count" : 0,
                  "create_weight" : 230746,
                  "next_doc" : 0,
                  "match" : 0,
                  "create_weight_count" : 1,
                  "next_doc_count" : 0,
                  "score_count" : 0,
                  "build_scorer" : 3648,
                  "advance" : 0,
                  "advance_count" : 0
                }

0 个答案:

没有答案