Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support match function in SQL/PPL query engine #184

Closed
6 tasks done
chloe-zh opened this issue Aug 20, 2021 · 2 comments · Fixed by #204
Closed
6 tasks done

Support match function in SQL/PPL query engine #184

chloe-zh opened this issue Aug 20, 2021 · 2 comments · Fixed by #204
Assignees
Labels
PPL Piped processing language SQL v1.2.0

Comments

@chloe-zh
Copy link
Contributor

chloe-zh commented Aug 20, 2021

Related design is presented in issue #182

Todo list

  • Support the match functionality by pushing it down to the search engine
  • Enable 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
  • Add unit tests. (Unit tests are mandatory for all code changes.)
  • Add integration test cases for match
  • Update user manual

Function details

The match function maps to the match query used in search engine, to return the documents that match a provided text, number, date or boolean value with a given field.

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

Available options:

  • analyzer
  • auto_generate_synonyms_phrase
  • fuzziness
  • max_expansions
  • prefix_length
  • fuzzy_transpositions
  • fuzzy_rewrite
  • lenient
  • operator
  • minimum_should_match
  • zero_terms_query
  • boost

Sample queries:

# Search query 1
GET my_index/_search
{
  "query": {
    "match": {
      "message": "this is a test"
    }
  }
}

# SQL
SELECT message FROM my_index WHERE match(message, "this is a test")

# PPL
search source=my_index | match field=message query="this is a test"


# Search query 2
GET my_index/_search
{
  "query": {
    "match": {
      "message": {
        "query": "this is a test",
        "operator": "and"
      }
    }
  }
}

# SQL
SELECT message FROM my_index WHERE match(message, "this is a test", operator=and)

# PPL
search source=my_index | match field=message query="this is a test" operator=and


# Search query 3
GET my_index/_search
{
  "query": {
    "match": {
      "message": {
        "query": "to be or not to be",
        "operator": "and",
        "zero_terms_query": "all"
      }
    }
  }
}

# SQL
SELECT message FROM my_index WHERE match(message, "this is a test", operator=and, zero_terms_query=all)

# PPL
search source=my_index | where match(message, "this is a test", operator=and, zero_terms_query=all)
@chloe-zh
Copy link
Contributor Author

chloe-zh commented Sep 7, 2021

@acarbonetto
Copy link
Collaborator

fixed by: #204 and #614

Yury-Fridlyand pushed a commit that referenced this issue Dec 7, 2022
* Add position() string function to PPL (#184)

Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PPL Piped processing language SQL v1.2.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants