19

When running this queries:

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

-

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

What is the difference? When to use one and when to use the other?

Félix Sanz
  • 1,812
  • 4
  • 16
  • 27

1 Answers1

26

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

Query string is therefore far more powerful, but it can also lead to unexpected scenarios, such as where / may cause part of the string to be interpreted as a regular expression.

DrTech does a pretty excellent job demonstrating the two over in this answer.

Community
  • 1
  • 1
pickypg
  • 22,034
  • 5
  • 72
  • 84