Skip to content

Support multi_match function in SQL/PPL query engine #188

@chloe-zh

Description

@chloe-zh

Related design is presented in issue #182

Todo list

  • Support the multi_match functionality by pushing it down to the search engine
  • Enable multi_match function in SQL and PPL syntax and parser, including all the available parameters
  • Make sure the function in new engine is compatible with the old engine support (including match_match and multimatch functions)
  • Add unit tests. (Unit tests are mandatory for all code changes.)
  • Add integration test cases for multi_match
  • Update user manual

Function details

The multi_match function maps the multi match query used in the search engine. This query builds on the match query to allow multi-field queries.

Syntax:
multi_match([field_list], query_expression[, option=<option_value>]*)

Available options:

  • analyzer
  • auto_generate_synonyms_phrase
  • boost
  • operator
  • minimum_should_match
  • lenient
  • zero_terms_query
  • type_breaker
  • cutoff_frequency
  • type (best_fields, most_fields, cross_fields, phrase, phrase_prefix, bool_prefix)

Sample queries:

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

# SQL
SELECT * FROM my_index WHERE multi_match([subject, message], "this is a test")

# PPL
source=my_index | where multi_match([subject, message], "this is a test")


# Search query 2
GET my_index/_search
{
  "query": {
    "multi_match" : {
      "query":      "brown fox",
      "type":       "best_fields",
      "fields":     [ "subject", "message" ],
      "tie_breaker": 0.3
    }
  }
}

# SQL
SELECT * FROM my_index WHERE multi_match([subject, message], "brown fox", type="best_fields", tie_breaker=0.3)

# PPL
source=my_index | where multi_match([subject, message], "this is a test", type="best_fields", tie_breaker=0.3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions