Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
29ca685
Upgrade opensearch-protobufs dependency to 0.7.0 and update transport…
akrahdan Aug 8, 2025
daa3789
Use 0.8.0 protos and fix transport-grpc compilation errors
karenyrx Aug 10, 2025
63a5820
Merge branch 'main' into protobufs-0.8.0-transport-grpc-fixes
karenyrx Aug 11, 2025
373713d
Add unit tests to improve transport-grpc module coverage
akrahdan Aug 11, 2025
89235c3
Improve test coverage for search query utilities
akrahdan Aug 12, 2025
5b9649e
Improve unit test coverage for search query utilities
akrahdan Aug 12, 2025
5333769
transport-grpc: update to opensearch-protobufs 0.9.0 and improve Fiel…
akrahdan Aug 13, 2025
a6bcd8b
Update transport-grpc to opensearch-protobufs 0.10.0-SNAPSHOT
akrahdan Aug 13, 2025
4a9a8eb
Merge branch 'main' into protobufs-0.8.0-transport-grpc-fixes
karenyrx Aug 13, 2025
f071c55
use 0.10.0
karenyrx Aug 13, 2025
e003fb4
remove map and refactor fieldvalueprotoutils.fromproto
karenyrx Aug 16, 2025
e7e3fbc
Merge branch 'main' into protobufs-0.8.0-transport-grpc-fixes
karenyrx Aug 16, 2025
d3cf943
forgot to commit spotlessApply changes
karenyrx Aug 16, 2025
f1031b0
Merge branch 'main' into protobufs-0.8.0-transport-grpc-fixes
karenyrx Aug 21, 2025
65ae49c
Merge branch 'main' into protobufs-0.8.0-transport-grpc-fixes
karenyrx Aug 22, 2025
00059c1
update to 0.12.0 protos
karenyrx Sep 12, 2025
78acf09
Merge branch 'main' into protobufs-0.8.0-transport-grpc-fixes
karenyrx Sep 12, 2025
40de639
fix compilation
karenyrx Sep 12, 2025
ae21a00
use 0.13.0
Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add temporal routing processors for time-based document routing ([#18920](https://github.com/opensearch-project/OpenSearch/issues/18920))
- The dynamic mapping parameter supports false_allow_templates ([#19065](https://github.com/opensearch-project/OpenSearch/pull/19065))
- Add a toBuilder method in EngineConfig to support easy modification of configs([#19054](https://github.com/opensearch-project/OpenSearch/pull/19054))
- Upgrade opensearch-protobufs dependency to 0.10.0 and update transport-grpc module compatibility ([#19007](https://github.com/opensearch-project/OpenSearch/issues/19007))

### Changed
- Add CompletionStage variants to methods in the Client Interface and default to ActionListener impl ([#18998](https://github.com/opensearch-project/OpenSearch/pull/18998))
Expand Down
2 changes: 1 addition & 1 deletion modules/transport-grpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies {
implementation "io.grpc:grpc-stub:${versions.grpc}"
implementation "io.grpc:grpc-util:${versions.grpc}"
implementation "io.perfmark:perfmark-api:0.27.0"
implementation "org.opensearch:protobufs:0.6.0"
implementation "org.opensearch:protobufs:0.10.0"
testImplementation project(':test:framework')
}

Expand Down
1 change: 1 addition & 0 deletions modules/transport-grpc/licenses/protobufs-0.10.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10b3dba8b0973fd6ed4ab530228a764bd624af40
1 change: 0 additions & 1 deletion modules/transport-grpc/licenses/protobufs-0.6.0.jar.sha1

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public void testDocumentServiceBulk() throws Exception {
DocumentServiceGrpc.DocumentServiceBlockingStub documentStub = DocumentServiceGrpc.newBlockingStub(channel);

// Create a bulk request with an index operation
IndexOperation indexOp = IndexOperation.newBuilder().setIndex(indexName).setId("1").build();
IndexOperation indexOp = IndexOperation.newBuilder().setXIndex(indexName).setXId("1").build();

BulkRequestBody requestBody = BulkRequestBody.newBuilder()
.setIndex(indexOp)
.setDoc(com.google.protobuf.ByteString.copyFromUtf8(DEFAULT_DOCUMENT_SOURCE))
.setOperationContainer(org.opensearch.protobufs.OperationContainer.newBuilder().setIndex(indexOp).build())
.setObject(com.google.protobuf.ByteString.copyFromUtf8(DEFAULT_DOCUMENT_SOURCE))
.build();

BulkRequest bulkRequest = BulkRequest.newBuilder().addRequestBody(requestBody).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testSearchServiceSearch() throws Exception {
searchResponse.getResponseBody().getHits().getTotal().getTotalHits().getValue() > 0
);
assertEquals("Search response should have one hit", 1, searchResponse.getResponseBody().getHits().getHitsCount());
assertEquals("Hit should have correct ID", "1", searchResponse.getResponseBody().getHits().getHits(0).getId());
assertEquals("Hit should have correct ID", "1", searchResponse.getResponseBody().getHits().getHits(0).getXId());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ public static FetchSourceContext parseFromProtoRequest(org.opensearch.protobufs.
String[] sourceIncludes = null;

// Set up source context if source parameters are provided
if (request.hasSource()) {
switch (request.getSource().getSourceConfigParamCase()) {
case SourceConfigParam.SourceConfigParamCase.BOOL_VALUE:
fetchSource = request.getSource().getBoolValue();
if (request.hasXSource()) {
switch (request.getXSource().getSourceConfigParamCase()) {
case BOOL_VALUE:
fetchSource = request.getXSource().getBoolValue();
break;
case SourceConfigParam.SourceConfigParamCase.STRING_ARRAY:
sourceIncludes = request.getSource().getStringArray().getStringArrayList().toArray(new String[0]);
case STRING_ARRAY:
sourceIncludes = request.getXSource().getStringArray().getStringArrayList().toArray(new String[0]);
break;
default:
throw new UnsupportedOperationException("Invalid sourceConfig provided.");
}
}

if (request.getSourceIncludesList().size() > 0) {
sourceIncludes = request.getSourceIncludesList().toArray(new String[0]);
if (request.getXSourceIncludesCount() > 0) {
sourceIncludes = request.getXSourceIncludesList().toArray(new String[0]);
}

if (request.getSourceExcludesList().size() > 0) {
sourceExcludes = request.getSourceExcludesList().toArray(new String[0]);
if (request.getXSourceExcludesCount() > 0) {
sourceExcludes = request.getXSourceExcludesList().toArray(new String[0]);
}
if (fetchSource != null || sourceIncludes != null || sourceExcludes != null) {
return new FetchSourceContext(fetchSource == null ? true : fetchSource, sourceIncludes, sourceExcludes);
Expand All @@ -81,8 +81,8 @@ public static FetchSourceContext parseFromProtoRequest(org.opensearch.protobufs.
String[] sourceExcludes = null;
String[] sourceIncludes = null;

if (request.hasSource()) {
SourceConfigParam source = request.getSource();
if (request.hasXSource()) {
SourceConfigParam source = request.getXSource();

if (source.hasBoolValue()) {
fetchSource = source.getBoolValue();
Expand All @@ -91,12 +91,12 @@ public static FetchSourceContext parseFromProtoRequest(org.opensearch.protobufs.
}
}

if (request.getSourceIncludesCount() > 0) {
sourceIncludes = request.getSourceIncludesList().toArray(new String[0]);
if (request.getXSourceIncludesCount() > 0) {
sourceIncludes = request.getXSourceIncludesList().toArray(new String[0]);
}

if (request.getSourceExcludesCount() > 0) {
sourceExcludes = request.getSourceExcludesList().toArray(new String[0]);
if (request.getXSourceExcludesCount() > 0) {
sourceExcludes = request.getXSourceExcludesList().toArray(new String[0]);
}

if (fetchSource != null || sourceIncludes != null || sourceExcludes != null) {
Expand All @@ -118,22 +118,16 @@ public static FetchSourceContext fromProto(SourceConfig sourceConfig) {
String[] excludes = Strings.EMPTY_ARRAY;
if (sourceConfig.getSourceConfigCase() == SourceConfig.SourceConfigCase.FETCH) {
fetchSource = sourceConfig.getFetch();
} else if (sourceConfig.hasIncludes()) {
ArrayList<String> list = new ArrayList<>();
for (String string : sourceConfig.getIncludes().getStringArrayList()) {
list.add(string);
}
includes = list.toArray(new String[0]);
} else if (sourceConfig.hasFilter()) {
SourceFilter sourceFilter = sourceConfig.getFilter();
if (!sourceFilter.getIncludesList().isEmpty()) {
if (sourceFilter.getIncludesCount() > 0) {
List<String> includesList = new ArrayList<>();
for (String s : sourceFilter.getIncludesList()) {
includesList.add(s);
}
includes = includesList.toArray(new String[0]);
}
if (!sourceFilter.getExcludesList().isEmpty()) {
if (sourceFilter.getExcludesCount() > 0) {
List<String> excludesList = new ArrayList<>();
for (String s : sourceFilter.getExcludesList()) {
excludesList.add(s);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static DocWriteRequest.OpType fromProto(OpType opType) {
return DocWriteRequest.OpType.CREATE;
case OP_TYPE_INDEX:
return DocWriteRequest.OpType.INDEX;
case OP_TYPE_UNSPECIFIED:
default:
throw new UnsupportedOperationException("Invalid optype: " + opType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public static Script parseFromProtoRequest(org.opensearch.protobufs.Script scrip
private static Script parseFromProtoRequest(org.opensearch.protobufs.Script script, String defaultLang) {
Objects.requireNonNull(defaultLang);

if (script.hasInlineScript()) {
return parseInlineScript(script.getInlineScript(), defaultLang);
} else if (script.hasStoredScriptId()) {
return parseStoredScriptId(script.getStoredScriptId());
if (script.hasInline()) {
return parseInlineScript(script.getInline(), defaultLang);
} else if (script.hasStored()) {
return parseStoredScriptId(script.getStored());
} else {
throw new UnsupportedOperationException("No valid script type detected");
}
Expand Down Expand Up @@ -118,10 +118,10 @@ public static Script parseStoredScriptId(StoredScriptId storedScriptId) {
* @throws UnsupportedOperationException if no language was specified
*/
public static String parseScriptLanguage(ScriptLanguage language, String defaultLang) {
if (language.hasStringValue()) {
return language.getStringValue();
if (language.hasCustom()) {
return language.getCustom();
}
switch (language.getBuiltinScriptLanguage()) {
switch (language.getBuiltin()) {
case BUILTIN_SCRIPT_LANGUAGE_EXPRESSION:
return "expression";
case BUILTIN_SCRIPT_LANGUAGE_JAVA:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ private ActiveShardCountProtoUtils() {
public static ActiveShardCount parseProto(WaitForActiveShards waitForActiveShards) {

switch (waitForActiveShards.getWaitForActiveShardsCase()) {
case WaitForActiveShards.WaitForActiveShardsCase.WAIT_FOR_ACTIVE_SHARD_OPTIONS:
case WAIT_FOR_ACTIVE_SHARD_OPTIONS:
switch (waitForActiveShards.getWaitForActiveShardOptions()) {
case WAIT_FOR_ACTIVE_SHARD_OPTIONS_UNSPECIFIED:
throw new UnsupportedOperationException("No mapping for WAIT_FOR_ACTIVE_SHARD_OPTIONS_UNSPECIFIED");
case WAIT_FOR_ACTIVE_SHARD_OPTIONS_ALL:
return ActiveShardCount.ALL;
case WAIT_FOR_ACTIVE_SHARD_OPTIONS_NULL:
case WAIT_FOR_ACTIVE_SHARD_OPTIONS_UNSPECIFIED:
default:
return ActiveShardCount.DEFAULT;
}
case WaitForActiveShards.WaitForActiveShardsCase.INT32_VALUE:
case INT32_VALUE:
return ActiveShardCount.from(waitForActiveShards.getInt32Value());
case WAITFORACTIVESHARDS_NOT_SET:
default:
return ActiveShardCount.DEFAULT;
}
Expand Down
Loading
Loading