You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update PrefixQuery, MatchQuery, ConstantScoreQuery and FuzzyQuery (opensearch-project#249)
* Update PrefixQuery, MatchQuery, ConstantScoreQuery and FuzzyQuery
Signed-off-by: xil <fridalu66@gmail.com>
* update
Signed-off-by: xil <fridalu66@gmail.com>
---------
Signed-off-by: xil <fridalu66@gmail.com>
// Use the match query for full-text search on a specific document field. If you run a match query on a text field, the match query analyzes the provided search string and returns documents that match any of the string's terms. If you run a match query on an exact-value field, it returns documents that match the exact value. The preferred way to search exact-value fields is to use a filter because, unlike a query, a filter is cached.
442
-
MatchQueryTypelessmatch=16;
442
+
MatchQuerymatch=16;
443
443
444
444
// The match_bool_prefix query analyzes the provided search string and creates a Boolean query from the string's terms. It uses every term except the last term as a whole word for matching. The last term is used as a prefix. The match_bool_prefix query returns documents that contain either the whole-word terms or terms that start with the prefix term, in any order.
445
445
MatchBoolPrefixQuerymatch_bool_prefix=17;
@@ -1315,89 +1315,37 @@ message KnnQueryRescore {
1315
1315
}
1316
1316
}
1317
1317
1318
-
messageMatchQueryTypeless {
1319
-
stringfield=1;
1320
-
oneofmatch_query_typeless {
1321
-
// Standard match query for performing a full-text search, including options for fuzzy matching.
1322
-
MatchQuerymatch_query=2;
1323
-
// Simplified match query syntax by combining the <field> and query parameters
1324
-
ObjectMapobject_map=3;
1325
-
}
1326
-
}
1327
-
1328
1318
messageMatchQuery {
1329
-
1319
+
// [required] Specifies the field against which to run a search query
1320
+
stringfield=1;
1321
+
// [required] The query string to use for search.
1322
+
FieldValuequery=2;
1330
1323
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
1331
-
optionalfloatboost=1;
1332
-
1324
+
optionalfloatboost=3;
1333
1325
// [optional] Query name for query tagging.
1334
-
optionalstringx_name=2;
1335
-
1336
-
// [optional]
1337
-
// The analyzer used to tokenize the query string text.
1338
-
// Default is the index-time analyzer specified for the default_field. If no analyzer is specified for the default_field, the analyzer is the default analyzer for the index.
1339
-
stringanalyzer=3;
1340
-
1341
-
// [optional]
1342
-
// Specifies whether to create a match phrase query automatically for multi-term synonyms.
1343
-
// For example, if you specify ba,batting average as synonyms and search for ba, OpenSearch searches for ba OR "batting average" (if this option is true) or ba OR (batting AND average) (if this option is false).
1344
-
// Default is true.
1345
-
boolauto_generate_synonyms_phrase_query=4;
1346
-
1347
-
// [x-deprecated]
1348
-
floatcutoff_frequency=5;
1349
-
1350
-
// [optional]
1351
-
// The number of character edits (insertions, deletions, substitutions, or transpositions) that it takes to change one word to another when determining whether a term matched a value.
1352
-
// For example, the distance between wined and wind is 1. Valid values are non-negative integers or AUTO.
1353
-
// The default, AUTO, chooses a value based on the length of each term and is a good choice for most use cases.
1354
-
Fuzzinessfuzziness=6;
1355
-
1356
-
// [optional]
1357
-
// Determines how OpenSearch rewrites the query.
1358
-
// Default is constant_score.
1359
-
MultiTermQueryRewritefuzzy_rewrite=7;
1360
-
// [optional]
1361
-
// Setting fuzzy_transpositions to true (default) adds swaps of adjacent characters to the insert, delete, and substitute operations of the fuzziness option.
1362
-
// For example, the distance between wind and wnid is 1 if fuzzy_transpositions is true (swap “n” and “i”) and 2 if it is false (delete “n”, insert “n”). If fuzzy_transpositions is false, rewind and wnid have the same distance (2) from wind, despite the more human-centric opinion that wnid is an obvious typo.
1363
-
// The default(true) is a good choice for most use cases.
1364
-
boolfuzzy_transpositions=8;
1365
-
1366
-
// [optional]
1367
-
// Setting lenient to true ignores data type mismatches between the query and the document field.
1368
-
// For example, a query string of "8.2" could match a field of type float.
1369
-
// Default is false.
1370
-
boollenient=9;
1371
-
1372
-
// [optional]
1373
-
// The maximum number of terms to which the query can expand. Fuzzy queries “expand to” a number of matching terms that are within the distance specified in fuzziness. Then OpenSearch tries to match those terms.
1374
-
// Default is 50.
1375
-
int32max_expansions=10;
1376
-
1377
-
// [optional]
1378
-
// If the query string contains multiple search terms and you use the or operator, the number of terms that need to match for the document to be considered a match.
1379
-
// For example, if minimum_should_match is 2, wind often rising does not match The Wind Rises. If minimum_should_match is 1, it matches.
1380
-
MinimumShouldMatchminimum_should_match=11;
1381
-
1382
-
// [optional]
1383
-
// If the query string contains multiple search terms, whether all terms need to match (AND) or only one term needs to match (OR) for a document to be considered a match.
1384
-
// Default is OR.
1385
-
Operatoroperator=12;
1386
-
1387
-
// [optional]
1388
-
// The number of leading characters that are not considered in fuzziness.
1389
-
// Default is 0.
1390
-
int32prefix_length=13;
1391
-
// [required]
1392
-
// The query string to use for search.
1393
-
FieldValuequery=14;
1394
-
1395
-
// [optional]
1396
-
// In some cases, the analyzer removes all terms from a query string.
1397
-
// For example, the stop analyzer removes all terms from the string an but this. In those cases, zero_terms_query specifies whether to match no documents (none) or all documents (all). Valid values are none and all.
1398
-
// Default is none.
1399
-
ZeroTermsQueryzero_terms_query=15;
1400
-
1326
+
optionalstringx_name=4;
1327
+
// [optional] The analyzer used to tokenize the query string text. Default is the index-time analyzer specified for the default_field. If no analyzer is specified for the default_field, the analyzer is the default analyzer for the index.
1328
+
optionalstringanalyzer=5;
1329
+
// [optional] Specifies whether to create a match phrase query automatically for multi-term synonyms. For example, if you specify ba,batting average as synonyms and search for ba, OpenSearch searches for ba OR "batting average" (if this option is true) or ba OR (batting AND average) (if this option is false).
// [optional] The number of character edits (insertions, deletions, substitutions, or transpositions) that it takes to change one word to another when determining whether a term matched a value. For example, the distance between wined and wind is 1. Valid values are non-negative integers or AUTO.
1332
+
optionalFuzzinessfuzziness=7;
1333
+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1334
+
optionalMultiTermQueryRewritefuzzy_rewrite=8;
1335
+
// [optional] Setting fuzzy_transpositions to true (default) adds swaps of adjacent characters to the insert, delete, and substitute operations of the fuzziness option. For example, the distance between wind and wnid is 1 if fuzzy_transpositions is true (swap “n” and “i”) and 2 if it is false (delete “n”, insert “n”). If fuzzy_transpositions is false, rewind and wnid have the same distance (2) from wind, despite the more human-centric opinion that wnid is an obvious typo. The default(true) is a good choice for most use cases.
1336
+
optionalboolfuzzy_transpositions=9;
1337
+
// [optional] Setting lenient to true ignores data type mismatches between the query and the document field. For example, a query string of "8.2" could match a field of type float. Default is false.
1338
+
optionalboollenient=10;
1339
+
// [optional] The maximum number of terms to which the query can expand. Fuzzy queries “expand to” a number of matching terms that are within the distance specified in fuzziness. Then OpenSearch tries to match those terms. Default is 50.
1340
+
optionalint32max_expansions=11;
1341
+
// [optional] If the query string contains multiple search terms and you use the or operator, the number of terms that need to match for the document to be considered a match. For example, if minimum_should_match is 2, wind often rising does not match The Wind Rises. If minimum_should_match is 1, it matches.
// [optional] If the query string contains multiple search terms, whether all terms need to match (AND) or only one term needs to match (OR) for a document to be considered a match. Default is OR.
1344
+
optionalOperatoroperator=13;
1345
+
// [optional] The number of leading characters that are not considered in fuzziness. Default is 0.
1346
+
optionalint32prefix_length=14;
1347
+
// [optional] In some cases, the analyzer removes all terms from a query string. For example, the stop analyzer removes all terms from the string an but this. In those cases, zero_terms_query specifies whether to match no documents (none) or all documents (all). Valid values are none and all. Default is none.
1348
+
optionalZeroTermsQueryzero_terms_query=15;
1401
1349
}
1402
1350
1403
1351
messageQuery {
@@ -1465,15 +1413,12 @@ message BoostingQuery {
1465
1413
}
1466
1414
1467
1415
messageConstantScoreQuery {
1468
-
1416
+
// [required] The filter query that a document must match to be returned in the results.
1417
+
QueryContainerfilter=1;
1469
1418
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
// [required] Specifies the field against which to run a search query
1740
1685
stringfield=1;
1741
-
1686
+
// [required] The term to search for in the field specified in <field>.
1687
+
stringvalue=2;
1742
1688
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
1743
-
optionalfloatboost=2;
1744
-
1689
+
optionalfloatboost=3;
1745
1690
// [optional] Query name for query tagging.
1746
-
optionalstringx_name=3;
1747
-
1748
-
// [optional]
1749
-
// Determines how OpenSearch rewrites the query.
1750
-
// Default is constant_score.
1751
-
MultiTermQueryRewriterewrite=4;
1752
-
1753
-
// [required]
1754
-
// The term to search for in the field specified in <field>.
1755
-
stringvalue=5;
1756
-
1757
-
// [optional]
1758
-
// Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`. Default is `false` which means the case sensitivity of matching depends on the underlying field's mapping.
1759
-
boolcase_insensitive=6;
1760
-
1691
+
optionalstringx_name=4;
1692
+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1693
+
optionalMultiTermQueryRewriterewrite=5;
1694
+
// [optional] Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`. Default is `false` which means the case sensitivity of matching depends on the underlying field's mapping.
1695
+
optionalboolcase_insensitive=6;
1761
1696
}
1762
1697
1763
1698
messageTermsLookupFieldStringArrayMap {
@@ -2121,35 +2056,22 @@ message RegexpQuery {
2121
2056
messageFuzzyQuery {
2122
2057
// [required] Specifies the field against which to run a search query
2123
2058
stringfield=1;
2124
-
2059
+
// [required] Term you wish to find in the provided <field>.
2060
+
FieldValuevalue=2;
2125
2061
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
2126
-
optionalfloatboost=2;
2127
-
2062
+
optionalfloatboost=3;
2128
2063
// [optional] Query name for query tagging.
2129
-
optionalstringx_name=3;
2130
-
2131
-
// [optional]
2132
-
// The maximum number of terms to which the query can expand. Fuzzy queries "expand to" a number of matching terms that are within the distance specified in fuzziness. Then OpenSearch tries to match those terms. Default is 50.
2133
-
int32max_expansions=4;
2134
-
2135
-
// [optional]
2136
-
// The number of leading characters that are not considered in fuzziness. Default is 0.
2137
-
int32prefix_length=5;
2138
-
2139
-
// [optional]
2140
-
// Determines how OpenSearch rewrites the query.
2141
-
// Default is constant_score.
2142
-
MultiTermQueryRewriterewrite=6;
2143
-
// [optional]
2144
-
// Specifies whether to allow transpositions of two adjacent characters (ab to ba) as edits. Default is true.
2145
-
booltranspositions=7;
2146
-
// [optional]
2147
-
// The number of character edits (insert, delete, substitute) needed to change one word to another when determining whether a term matched a value.
2148
-
Fuzzinessfuzziness=8;
2149
-
2150
-
// [required]
2151
-
// Term you wish to find in the provided <field>.
2152
-
FieldValuevalue=9;
2064
+
optionalstringx_name=4;
2065
+
// [optional] The maximum number of terms to which the query can expand. Fuzzy queries "expand to" a number of matching terms that are within the distance specified in fuzziness. Then OpenSearch tries to match those terms. Default is 50.
2066
+
optionalint32max_expansions=5;
2067
+
// [optional] The number of leading characters that are not considered in fuzziness. Default is 0.
2068
+
optionalint32prefix_length=6;
2069
+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
2070
+
optionalMultiTermQueryRewriterewrite=7;
2071
+
// [optional] Specifies whether to allow transpositions of two adjacent characters (ab to ba) as edits. Default is true.
2072
+
optionalbooltranspositions=8;
2073
+
// [optional] The number of character edits (insert, delete, substitute) needed to change one word to another when determining whether a term matched a value.
2074
+
optionalFuzzinessfuzziness=9;
2153
2075
}
2154
2076
2155
2077
messageFuzziness{
@@ -2387,36 +2309,39 @@ message MultiMatchQuery {
2387
2309
// [optional] Determines how OpenSearch rewrites the query. Valid values are constant_score, scoring_boolean, constant_score_boolean, top_terms_N, top_terms_boost_N, and top_terms_blended_freqs_N. If the fuzziness parameter is not 0, the query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default. Default is constant_score.
2388
2310
optionalstringfuzzy_rewrite=7;
2389
2311
2312
+
// [optional] The number of character edits (insert, delete, substitute) that it takes to change one word to another when determining whether a term matched a value.
2313
+
optionalFuzzinessfuzziness=8;
2314
+
2390
2315
// [optional] Setting fuzzy_transpositions to true (default) adds swaps of adjacent characters to the insert, delete, and substitute operations of the fuzziness option. For example, the distance between wind and wnid is 1 if fuzzy_transpositions is true (swap “n” and “i”) and 2 if it is false (delete “n”, insert “n”). If fuzzy_transpositions is false, rewind and wnid have the same distance (2) from wind, despite the more human-centric opinion that wnid is an obvious typo. The default is a good choice for most use cases.
2391
-
optionalboolfuzzy_transpositions=8;
2316
+
optionalboolfuzzy_transpositions=9;
2392
2317
2393
2318
// [optional] Setting lenient to true ignores data type mismatches between the query and the document field. For example, a query string of "8.2" could match a field of type float. Default is false.
2394
-
optionalboollenient=9;
2319
+
optionalboollenient=10;
2395
2320
2396
2321
// [optional] The maximum number of terms to which the query can expand. Fuzzy queries “expand to” a number of matching terms that are within the distance specified in fuzziness. Then OpenSearch tries to match those terms. Default is 50.
2397
-
optionalint32max_expansions=10;
2322
+
optionalint32max_expansions=11;
2398
2323
2399
2324
// [optional] If the query string contains multiple search terms and you use the or operator, the number of terms that need to match for the document to be considered a match. For example, if minimum_should_match is 2, wind often rising does not match The Wind Rises. If minimum_should_match is 1, it matches. For details, see Minimum should match.
// [optional] If the query string contains multiple search terms, whether all terms need to match (AND) or only one term needs to match (OR) for a document to be considered a match. Valid values are: 1) OR: The string to be is interpreted as to OR be. 2) AND: The string to be is interpreted as to AND be. Default is OR.
2404
-
optionalOperatoroperator=12;
2329
+
optionalOperatoroperator=13;
2405
2330
2406
2331
// [optional] The number of leading characters that are not considered in fuzziness. Default is 0.
2407
-
optionalint32prefix_length=13;
2332
+
optionalint32prefix_length=14;
2408
2333
2409
2334
// [optional] Controls the degree to which words in a query can be misordered and still be considered a match. From the Lucene documentation: “The number of other words permitted between words in query phrase. For example, to switch the order of two words requires two moves (the first move places the words atop one another), so to permit reorderings of phrases, the slop must be at least two. A value of zero requires an exact match.” Supported for phrase and phrase_prefix query types.
2410
-
optionalint32slop=14;
2335
+
optionalint32slop=15;
2411
2336
2412
2337
// [optional] A factor between 0 and 1.0 that is used to give more weight to documents that match multiple query clauses. For more information, see The tie_breaker parameter`.
2413
-
optionalfloattie_breaker=15;
2338
+
optionalfloattie_breaker=16;
2414
2339
2415
2340
// [optional] The multi-match query type. Valid values are best_fields, most_fields, cross_fields, phrase, phrase_prefix, bool_prefix. Default is best_fields.
2416
-
optionalTextQueryTypetype=16;
2341
+
optionalTextQueryTypetype=17;
2417
2342
2418
2343
// [optional] In some cases, the analyzer removes all terms from a query string. For example, the stop analyzer removes all terms from the string an but this. In those cases, zero_terms_query specifies whether to match no documents (none) or all documents (all). Valid values are none and all. Default is none.
0 commit comments