Skip to content

Multi Match Query

ignacio-alorre edited this page May 27, 2019 · 9 revisions

The multi_match query builds on the match query to allow multi-field queries:

GET /_search
{
  "query": {
    "multi_match" : {
      "query":    "this is a test", 
      "fields": [ "subject", "message" ] 
    }
  }
}

Where:

  • query: The query string
  • fields: The fields to be queried. Fields can be specified as wildcards

Example

The following example would query title, first_name and last_name

GET /_search
{
  "query": {
    "multi_match" : {
      "query":    "Will Smith",
      "fields": [ "title", "*_name" ] 
    }
  }
}

Individual fields can be boosted with the caret (^) notation. In the following query the subject field is three times as important as the message field.

GET /_search
{
  "query": {
    "multi_match" : {
      "query" : "this is a test",
      "fields" : [ "subject^3", "message" ] 
    }
  }
}

Types of multi_match query

The way the multi_match query is executed internally depends on the type parameter, which can be set to:

Clone this wiki locally