query_string和multi_match之间的区别是什么?

时间:2016-06-07 21:46:24

标签: elasticsearch lucene

运行此查询时:

{
  "query_string" : {
    "query" : "text",
    "fields": ["field1", "field2"]
  }
}

-

{
  "multi_match" : {
    "query" : "text",
    "fields": ["field1", "field2"]
  }
}

有什么区别?何时使用另一个?何时使用另一个?

1 个答案:

答案 0 :(得分:14)

query_string supports Lucene syntax to interpret the text,其中multi_match just attempts to match the given "text" against the listed fields' indexed values

查询字符串因此功能更强大,但它也可能导致意外情况,例如/可能导致部分字符串被解释为正则表达式。

DrTech做了非常出色的工作,展示了两个in this answer

相关问题