在Elasticsearch中_all的模糊性

时间:2016-06-23 09:47:37

标签: elasticsearch

我想知道是否有办法在Elasticsearch中将fuzziness应用于_all。

我尝试了以下查询但没有成功。

curl -XGET localhost:9200/superindex/_search?pretty -d '{"query": {"match": {"_all": "hapiness", "fuzziness": "AUTO"}}, "from": 0, "size": 2}'

收到错误。

{
  "error" : {
    "root_cause" : [ {
      "type" : "query_parsing_exception",
      "reason" : "[match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?",
      "index" : "carenotes_etl",
      "line" : 1,
      "col" : 40
    } ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [ {
      "shard" : 0,
      "index" : "carenotes_etl",
      "node" : "cMRfwQ3eS12eVkjfMOHYuQ",
      "reason" : {
        "type" : "query_parsing_exception",
        "reason" : "[match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?",
        "index" : "carenotes_etl",
        "line" : 1,
        "col" : 40
      }
    } ]
  },
  "status" : 400
}

1 个答案:

答案 0 :(得分:1)

以下查询适用于我。

curl -XGET localhost:9200/superindex/_search?pretty -d '{"query": {"multi_match": {"query": "dmentia", "fields": "_all", "fuzziness": "AUTO"}}, "from": 0, "size": 2}'