9

Can someone tell me the difference between

"query": {
    "bool": {
        "should": [
            { "match": {"title": keyword} },
            { "match": {"description": keyword} }
        ]
    }

and

"query": {
        "multi_match": {
            "query": keyword,
            "fields": [ "title", "description" ]
        }
    }

Is there any performance turning if choose one of two above?

trungnnh
  • 263
  • 2
  • 7

1 Answers1

5

It depends on the type parameter of your multi_match. In your example, since you didn't specify a type, best_fields is used. That makes use of a Dis Max Query and basically

uses the _score from the best field

On the other hand, your example with should

combines the _score from each field.

and it is equivalent to multi_match with type most_fields

Mario Trucco
  • 1,933
  • 3
  • 33
  • 45
  • Thank you @Mario, for more details: [elasticsearch what is the difference between best_field and most_field](https://stackoverflow.com/questions/35393793/elasticsearch-what-is-the-difference-between-best-field-and-most-field). – Bilal Jan 22 '20 at 14:32