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_bool_prefix function in SQL/PPL query engine #187

Closed
5 tasks
chloe-zh opened this issue Aug 20, 2021 · 0 comments · Fixed by #634
Closed
5 tasks

Support match_bool_prefix function in SQL/PPL query engine #187

chloe-zh opened this issue Aug 20, 2021 · 0 comments · Fixed by #634

Comments

@chloe-zh
Copy link
Contributor

chloe-zh commented Aug 20, 2021

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")
forestmvey referenced this issue in Bit-Quill/opensearch-project-sql May 27, 2022
…nsearch-project-sql into dev-match_bool_prefix-2#187
forestmvey referenced this issue in Bit-Quill/opensearch-project-sql Jun 1, 2022
forestmvey referenced this issue in Bit-Quill/opensearch-project-sql Jun 6, 2022
MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Jun 18, 2022
…efix-#187

# Conflicts:
#	core/src/main/java/org/opensearch/sql/expression/DSL.java
#	core/src/main/java/org/opensearch/sql/expression/function/OpenSearchFunctions.java
#	docs/user/dql/functions.rst
#	opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilder.java
#	ppl/src/main/antlr/OpenSearchPPLLexer.g4
#	sql/src/main/antlr/OpenSearchSQLParser.g4
MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Jun 23, 2022
joshuali925 pushed a commit that referenced this issue Jun 27, 2022
Signed-off-by: MaxKsyunz <[email protected]>

Co-authored-by: MaxKsyunz <[email protected]>
Co-authored-by: Max Ksyunz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant