Repository navigation
Closed
Description
Related design is presented in issue #182
Todo list
- Support the
matchfunctionality by pushing it down to the search engine - Enable
matchfunction 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)
Activity
chloe-zh commentedon Sep 7, 2021
PoC: https://github.com/chloe-zh/opensearch-sql/tree/poc/match
Merge remote-tracking branch 'upstream/main' into issue/opensearch-pr…
acarbonetto commentedon Aug 4, 2022
fixed by: #204 and #614
Add position() string function to PPL (#1147)