Skip to content

Support match_bool_prefix function in SQL/PPL query engine #187

@chloe-zh

Description

@chloe-zh

Related design is presented in issue #182

Todo list

  • Support the match_bool_prefix functionality by pushing it down to the search engine
  • Enable match_bool_prefix function in SQL and PPL syntax and parser, including all the available parameters
  • Add unit tests. (Unit tests are mandatory for all code changes.)
  • Add integration test cases for match_bool_prefix
  • Update user manual

Function details

The match_bool_prefix function maps to the match bool prefix query in the search engine. This query analyzes its input and constructs a bool query from the terms. Each term except the last is used in a term query. The last term is used in a prefix query.

Syntax:
match_phrase_prefix(field_expression, query_expression[, option=<option_value>]*)

Available options:

  • minimum_should_match
  • fuziness
  • prefix_length
  • max_expansions
  • fuzzy_transpositions
  • fuzzy_rewrite

Sample queries:

# Search query 
GET my_index/_search
{
  "query": {
    "match_bool_prefix": {
      "message": {
        "query": "quick brown f",
        "analyzer": "keyword"
      }
    }
  }
}

# SQL
SELECT * FROM my_index WHERE match_bool_prefix(message, "quick brown f", analyzer="keyword")

# PPL
source=my_index | where match_bool_prefix(message, "quick brown f", analyzer="keyword")

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