ES 查询优化(一)

2022-01-24 00:00:00 查询 数据 字段 计算 希望

1、能用term就不用match_phrase

The Lucene nightly benchmarks show that a simple term query is about 10 times as fast as a phrase query, and about 20 times as fast as a proximity query (a phrase query with slop).

term查询比match_phrase性能要快10倍,比带slop的match_phrase快20倍。

GET /my_index/my_type/_search
{
    "query": {
        "match_phrase": {
            "title": "quick"
        }
    }
}

变为

GET /my_index/my_type/_search
{
    "query": {
        "term": {
            "title": "quick"
        }
    }
}

相关文章