Skip to content

Commit 3739e53

Browse files
author
karenx
committed
[GRPC] Throw exceptions for currently unsupported request-side fields
Signed-off-by: karenx <[email protected]>
1 parent b7f013f commit 3739e53

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7272
- Bump opensearch-protobufs dependency to 0.24.0 and update transport-grpc module compatibility ([#20059](https://github.com/opensearch-project/OpenSearch/pull/20059))
7373

7474
- Refactor the ShardStats, WarmerStats and IndexingPressureStats class to use the Builder pattern instead of constructors ([#19966](https://github.com/opensearch-project/OpenSearch/pull/19966))
75+
- Throw exceptions for currently unsupported GRPC request-side fields ([#x](https://github.com/opensearch-project/OpenSearch/pull/x))
7576

7677
### Fixed
7778
- Fix Allocation and Rebalance Constraints of WeightFunction are incorrectly reset ([#19012](https://github.com/opensearch-project/OpenSearch/pull/19012))

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/document/bulk/BulkRequestProtoUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ public static org.opensearch.action.bulk.BulkRequest prepareRequest(BulkRequest
8585
)
8686
);
8787

88+
// Type is a deprecated field according to the spec, thus no plans to support it
89+
if (request.hasType()) {
90+
throw new UnsupportedOperationException("type param is not supported");
91+
}
92+
93+
// TODO support global_params
94+
if (request.hasGlobalParams()) {
95+
throw new UnsupportedOperationException("global_params param is not supported yet");
96+
}
97+
8898
return bulkRequest;
8999
}
90100
}

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchRequestProtoUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ protected static void parseSearchRequest(
183183
? parseTimeValue(request.getCancelAfterTimeInterval(), null, "cancel_after_time_interval")
184184
: null
185185
);
186+
187+
// TODO support typed_keys
188+
if (request.hasTypedKeys()) {
189+
throw new UnsupportedOperationException("typed_keys param is not supported yet");
190+
}
191+
192+
// TODO support global_params
193+
if (request.hasGlobalParams()) {
194+
throw new UnsupportedOperationException("global_params param is not supported yet");
195+
}
186196
}
187197

188198
/**

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,18 @@ private static void parseNonQueryFields(
154154
}
155155

156156
// TODO support aggregations
157-
/*
158-
if(protoRequest.hasAggs()){}
159-
*/
157+
if (protoRequest.getAggregationsCount() > 0) {
158+
throw new UnsupportedOperationException("aggregations param is not supported yet");
159+
}
160160

161161
if (protoRequest.hasHighlight()) {
162162
searchSourceBuilder.highlighter(HighlightBuilderProtoUtils.fromProto(protoRequest.getHighlight(), registry));
163163
}
164+
165+
// TODO support suggest
164166
if (protoRequest.hasSuggest()) {
165-
searchSourceBuilder.suggest(SuggestBuilderProtoUtils.fromProto(protoRequest.getSuggest()));
167+
throw new UnsupportedOperationException("suggest param is not supported yet");
168+
// searchSourceBuilder.suggest(SuggestBuilderProtoUtils.fromProto(protoRequest.getSuggest()));
166169
}
167170
if (protoRequest.getRescoreCount() > 0) {
168171
for (Rescore rescore : protoRequest.getRescoreList()) {

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ private static TermsLookup parseTermsLookup(org.opensearch.protobufs.TermsLookup
249249
if (lookup.hasRouting()) {
250250
tl.routing(lookup.getRouting());
251251
}
252+
if (lookup.hasStore()) {
253+
tl.store(lookup.getStore());
254+
}
252255
return tl;
253256
}
254257
}

0 commit comments

Comments
 (0)