Skip to content

Commit e0052bb

Browse files
authored
Backward compatible change for implemented query types RegexpQuery, WildcardQuery, PrefixQuery, MultiMatchQuery, MatchQuery, MatchBoolPrefixQuery, FuzzyQuery and ErrorCause (opensearch-project#325)
* Backward Incompatible change for implemented query types RegexpQuery, WildcardQuery, PrefixQuery, MultiMatchQuery, MatchQuery, MatchBoolPrefixQuery, FuzzyQuery and ErrorCause Signed-off-by: xil <fridalu66@gmail.com> * change suffix from enum to deprecated Signed-off-by: xil <fridalu66@gmail.com> --------- Signed-off-by: xil <fridalu66@gmail.com>
1 parent 5d8c538 commit e0052bb

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1010
- Preprocessing - Support x-protobuf-required to enforce required protobuf field and convert oneOf properties pattern to min/max Properties = 1 ([#318](https://github.com/opensearch-project/opensearch-protobufs/pull/318))
1111

1212
### Changed
13-
- Backward Incompatible change for unimplemented query types `ScriptScoreQuery`, `SimpleQueryStringQuery`, `DisMaxQuery`, `IntervalsQuery`, `QueryStringQuery` and `TermsAggregation`
13+
- Backward Incompatible change for unimplemented query types `ScriptScoreQuery`, `SimpleQueryStringQuery`, `DisMaxQuery`, `IntervalsQuery`, `QueryStringQuery` and `TermsAggregation` ([#324](https://github.com/opensearch-project/opensearch-protobufs/pull/324))
14+
- Backward Incompatible change for implemented query types `RegexpQuery`, `WildcardQuery`, `PrefixQuery`, `MultiMatchQuery`, `MatchQuery`, `MatchBoolPrefixQuery`, `FuzzyQuery` and `ErrorCause` ([#325](https://github.com/opensearch-project/opensearch-protobufs/pull/325))
1415

1516
### Removed
1617
- Removed unused messages ([#319](https://github.com/opensearch-project/opensearch-protobufs/pull/319))

protos/schemas/common.proto

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,6 @@ message StringArray{
193193
repeated string string_array = 1;
194194
}
195195

196-
message StringOrStringArray {
197-
oneof string_or_string_array{
198-
string string = 1;
199-
StringArray string_array = 2;
200-
}
201-
}
202-
203196
message SourceConfig {
204197

205198
oneof source_config{
@@ -240,7 +233,7 @@ message ErrorCause {
240233
optional ObjectMap metadata = 7;
241234

242235
// [optional]
243-
map<string, StringOrStringArray> header = 8;
236+
map<string, StringArray> header = 8;
244237
}
245238
message ShardStatistics {
246239
// [required] Number of shards that failed to execute the request. Note that shards that are not allocated will be considered neither successful nor failed. Having failed+successful less than total is thus an indication that some of the shards were not allocated.
@@ -1131,14 +1124,16 @@ message WildcardQuery {
11311124
// [optional] Allows case insensitive matching of the pattern 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.
11321125
optional bool case_insensitive = 4;
11331126

1134-
optional MultiTermQueryRewrite rewrite = 5;
1127+
optional MultiTermQueryRewrite rewrite_deprecated = 5 [deprecated = true];
11351128

11361129
// [optional] Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set.
11371130
optional string value = 6;
11381131

11391132
// [optional] Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set.
11401133
optional string wildcard = 7;
11411134

1135+
optional string rewrite = 8;
1136+
11421137
}
11431138

11441139
enum MultiTermQueryRewrite {
@@ -1249,7 +1244,7 @@ message MatchQuery {
12491244
// [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.
12501245
optional Fuzziness fuzziness = 7;
12511246
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1252-
optional MultiTermQueryRewrite fuzzy_rewrite = 8;
1247+
optional MultiTermQueryRewrite fuzzy_rewrite_deprecated = 8 [deprecated = true];
12531248
// [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.
12541249
optional bool fuzzy_transpositions = 9;
12551250
// [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.
@@ -1264,6 +1259,8 @@ message MatchQuery {
12641259
optional int32 prefix_length = 14;
12651260
// [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.
12661261
optional ZeroTermsQuery zero_terms_query = 15;
1262+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1263+
optional string fuzzy_rewrite = 16;
12671264
}
12681265

12691266
message BoolQuery {
@@ -1593,9 +1590,11 @@ message PrefixQuery {
15931590
// [optional] Query name for query tagging.
15941591
optional string x_name = 4;
15951592
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1596-
optional MultiTermQueryRewrite rewrite = 5;
1593+
optional MultiTermQueryRewrite rewrite_deprecated = 5 [deprecated = true];
15971594
// [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.
15981595
optional bool case_insensitive = 6;
1596+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1597+
optional string rewrite = 7;
15991598
}
16001599

16011600
enum TermsQueryValueType {
@@ -1675,7 +1674,10 @@ message RegexpQuery {
16751674
optional int32 max_determinized_states = 7;
16761675

16771676
// [optional] Determines how OpenSearch rewrites and scores multi-term queries. Valid values are constant_score, scoring_boolean, constant_score_boolean, top_terms_N, top_terms_boost_N, and top_terms_blended_freqs_N. Default is constant_score.
1678-
optional MultiTermQueryRewrite rewrite = 8;
1677+
optional MultiTermQueryRewrite rewrite_deprecated = 8 [deprecated = true];
1678+
1679+
// [optional] Determines how OpenSearch rewrites and scores multi-term queries. Valid values are constant_score, scoring_boolean, constant_score_boolean, top_terms_N, top_terms_boost_N, and top_terms_blended_freqs_N. Default is constant_score.
1680+
optional string rewrite = 9;
16791681
}
16801682

16811683
message TermQuery {
@@ -1932,11 +1934,13 @@ message FuzzyQuery {
19321934
// [optional] The number of leading characters that are not considered in fuzziness. Default is 0.
19331935
optional int32 prefix_length = 6;
19341936
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1935-
optional MultiTermQueryRewrite rewrite = 7;
1937+
optional MultiTermQueryRewrite rewrite_deprecated = 7 [deprecated = true];
19361938
// [optional] Specifies whether to allow transpositions of two adjacent characters (ab to ba) as edits. Default is true.
19371939
optional bool transpositions = 8;
19381940
// [optional] The number of character edits (insert, delete, substitute) needed to change one word to another when determining whether a term matched a value.
19391941
optional Fuzziness fuzziness = 9;
1942+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
1943+
optional string rewrite = 10;
19401944
}
19411945

19421946
message Fuzziness{
@@ -2035,7 +2039,7 @@ message MatchBoolPrefixQuery {
20352039
// [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. For example, the distance between wined and wind is 1. The default, AUTO, chooses a value based on the length of each term and is a good choice for most use cases.
20362040
optional Fuzziness fuzziness = 6;
20372041
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
2038-
optional MultiTermQueryRewrite fuzzy_rewrite = 7;
2042+
optional MultiTermQueryRewrite fuzzy_rewrite_deprecated = 7 [deprecated = true];
20392043
// [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.
20402044
optional bool fuzzy_transpositions = 8;
20412045
// [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.
@@ -2046,6 +2050,8 @@ message MatchBoolPrefixQuery {
20462050
optional Operator operator = 11;
20472051
// [optional] The number of leading characters that are not considered in fuzziness. Default is 0.
20482052
optional int32 prefix_length = 12;
2053+
// [optional] Determines how OpenSearch rewrites the query. Default is constant_score.
2054+
optional string fuzzy_rewrite = 13;
20492055
}
20502056

20512057
message MatchNoneQuery {
@@ -2122,7 +2128,7 @@ message MultiMatchQuery {
21222128
repeated string fields = 6;
21232129

21242130
// [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.
2125-
optional MultiTermQueryRewrite fuzzy_rewrite = 7;
2131+
optional MultiTermQueryRewrite fuzzy_rewrite_deprecated = 7 [deprecated = true];
21262132

21272133
// [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.
21282134
optional Fuzziness fuzziness = 8;
@@ -2157,6 +2163,8 @@ message MultiMatchQuery {
21572163

21582164
// [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.
21592165
optional ZeroTermsQuery zero_terms_query = 18;
2166+
// [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.
2167+
optional string fuzzy_rewrite = 19;
21602168
}
21612169

21622170
message FieldValueFactorScoreFunction {

0 commit comments

Comments
 (0)