使用模糊度优化Elasticsearch查询的时间

时间:2018-09-14 06:35:50

标签: elasticsearch fuzzy-search

下面的搜索查询大约需要2356毫秒来提取50条记录。 模糊性导致搜索速度变慢。如何使用模糊度提高性能? (不能跳过突出显示)

{
  "from": 0,
  "size": 50,
  "query": {
    "bool": {
      "must": {
        "multi_match": {
          "query": "shall have the right",
          "fields": [
            "subType",
            "title",
            "type",
            "content"
          ],
          "fuzziness": "AUTO",
          "minimum_should_match": "80%"
        }
      },
      "should": {
        "multi_match": {
          "query": "shall have the right",
          "fields": [
            "subType",
            "title",
            "type",
            "content"
          ],
          "type": "phrase",
          "slop": 1
        }
      }
    }
  },
  "aggregations": {
    "agg_example": {
      "terms": {
        "field": "type.keyword"
      }
    }
  },
  "highlight": {
    "type": "unified",
    "fields": {
      "*": {}
    }
  }
}

0 个答案:

没有答案