Skip to content

[GRPC] Upgrade protobufs to 1.1.0#20396

Merged
karenyrx merged 5 commits intoopensearch-project:mainfrom
lucy66hw:protobuf1.1
Jan 9, 2026
Merged

[GRPC] Upgrade protobufs to 1.1.0#20396
karenyrx merged 5 commits intoopensearch-project:mainfrom
lucy66hw:protobuf1.1

Conversation

@lucy66hw
Copy link
Contributor

@lucy66hw lucy66hw commented Jan 9, 2026

Description

Address Compilation for Bumping OpenSearch Protobuf Version to 1.1.0.
opensearch-project/opensearch-protobufs@1.0.0...1.1.0#diff-2b931e620077c456566a9d1378628816a249e38700b6ca55bbea3e8ec080f1d1

Protobuf Changes

File Changes Made
SearchHitProtoUtils.java Use matched_queries_2 with StringArray or DoubleMap
GeoPointProtoUtils.java Changed hasDoubleArray() → hasCoords() and getDoubleArray() → getCoords()
TermsQueryBuilderProtoUtils.java Changed FIELD_VALUE_ARRAY → VALUE

Test Plan

1, create mapping

curl -X PUT "localhost:9200/products" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "analyzer": "standard"
      },
      "price": {
        "type": "float"
      },
      "color": {
        "type": "keyword"
      },
      "brand": {
        "type": "keyword"
      },
      "description": {
        "type": "text"
      }
    }
  }
}
'

2, Index Sample Documents

curl -X POST "localhost:9200/_bulk" \
  -H "Content-Type: application/x-ndjson" \
  -d '
{ "index": { "_index": "products", "_id": "1" } }
{ "name": "Dell XPS Laptop", "price": 1500, "color": "silver", "brand": "Dell", "description": "High-performance laptop with Intel i7 processor" }
{ "index": { "_index": "products", "_id": "2" } }
{ "name": "Apple MacBook Pro", "price": 2500, "color": "silver", "brand": "Apple", "description": "Professional laptop with M1 chip" }
{ "index": { "_index": "products", "_id": "3" } }
{ "name": "Lenovo IdeaPad", "price": 600, "color": "black", "brand": "Lenovo", "description": "Budget-friendly laptop for everyday use" }
'

3, grpc Request (Default false)

 % grpcurl -plaintext \
  -import-path ~/opensearch \
  -proto ~/opensearch/protos/services/search_service.proto \
  -d @ localhost:9400 org.opensearch.protobufs.services.SearchService/Search <<EOM
{
  "index": ["products"],
  "search_request_body": {
    "query": {
      "bool": {
        "filter": [
          {
            "bool": {
              "x_name": "price_filter",
              "filter": [
                {
                  "range": {
                    "number_range_query": {
                      "field": "price",
                      "gte": 500,
                      "lte": 2000
                    }
                  }
                }
              ]
            }
          },
          {
            "bool": {
              "x_name": "color_filter",
              "filter": [
                {
                  "term": {
                    "field": "color",
                    "value": {
                      "string": "silver"
                    }
                  }
                }
              ]
            }
          }
        ]
      }
    },
    "include_named_queries_score": false
  }
}
EOM

4, gRPC response

{
  "took": "6",
  "xShards": {
    "successful": 1,
    "total": 1,
    "skipped": 0
  },
  "hits": {
    "total": {
      "totalHits": {
        "relation": "TOTAL_HITS_RELATION_EQ",
        "value": "1"
      }
    },
    "hits": [
      {
        "xIndex": "products",
        "xId": "1",
        "xScore": {
          "double": 0
        },
        "xSource": "CnsKICAibmFtZSI6ICJEZWxsIFhQUyBMYXB0b3AiLAogICJwcmljZSI6IDE1MDAsCiAgImNvbG9yIjogInNpbHZlciIsCiAgImJyYW5kIjogIkRlbGwiLAogICJkZXNjcmlwdGlvbiI6ICJIaWdoLXBlcmZvcm1hbmNlIGxhcHRvcCB3aXRoIEludGVsIGk3IHByb2Nlc3NvciIKfQo=",
        "matchedQueries2": {
          "names": {
            "stringArray": [
              "color_filter",
              "price_filter"
            ]
          }
        }
      }
    ],
    "maxScore": {
      "float": 0
    }
  }
}

5, Manual change hardcoded params to true
6, gRPC request

 % grpcurl -plaintext \
  -import-path ~/opensearch \
  -proto ~/opensearch/protos/services/search_service.proto \
  -d @ localhost:9400 org.opensearch.protobufs.services.SearchService/Search <<EOM
{
  "index": ["products"],
  "search_request_body": {
    "query": {
      "bool": {
        "filter": [
          {
            "bool": {
              "x_name": "price_filter",
              "filter": [
                {
                  "range": {
                    "number_range_query": {
                      "field": "price",
                      "gte": 500,
                      "lte": 2000
                    }
                  }
                }
              ]
            }
          },
          {
            "bool": {
              "x_name": "color_filter",
              "filter": [
                {
                  "term": {
                    "field": "color",
                    "value": {
                      "string": "silver"
                    }
                  }
                }
              ]
            }
          }
        ]
      }
    },
    "include_named_queries_score": true
  }
}
EOM

7, gRPC response

{
  "took": "108",
  "xShards": {
    "successful": 1,
    "total": 1,
    "skipped": 0
  },
  "hits": {
    "total": {
      "totalHits": {
        "relation": "TOTAL_HITS_RELATION_EQ",
        "value": "1"
      }
    },
    "hits": [
      {
        "xIndex": "products",
        "xId": "1",
        "xScore": {
          "double": 0
        },
        "xSource": "CnsKICAibmFtZSI6ICJEZWxsIFhQUyBMYXB0b3AiLAogICJwcmljZSI6IDE1MDAsCiAgImNvbG9yIjogInNpbHZlciIsCiAgImJyYW5kIjogIkRlbGwiLAogICJkZXNjcmlwdGlvbiI6ICJIaWdoLXBlcmZvcm1hbmNlIGxhcHRvcCB3aXRoIEludGVsIGk3IHByb2Nlc3NvciIKfQo=",
        "matchedQueries2": {
          "scores": {
            "doubleMap": {
              "color_filter": 0,
              "price_filter": 0
            }
          }
        }
      }
    ],
    "maxScore": {
      "float": 0
    }
  }
}

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Summary by CodeRabbit

  • Chores

    • Bumped opensearch-protobufs to v1.1.0, updated transport-grpc compatibility, and refreshed checksum artifacts; added changelog entry.
  • Chores (API)

    • Aligned protobuf builder field names for geo coordinates and term/value arrays with the new protobuf release.
  • Tests

    • Added tests for matched-queries serialization and updated proto conversion tests to match the protobuf API changes.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

Bumps opensearch-protobufs from 1.0.0 to 1.1.0 and updates transport-grpc code, tests, and checksum files to match protobuf API renames for coords, value fields, and matched-queries handling.

Changes

Cohort / File(s) Summary
Dependency Version Bump
CHANGELOG.md, gradle/libs.versions.toml
Updated opensearch-protobufs from 1.0.01.1.0 and added changelog entry.
License Checksums
modules/transport-grpc/licenses/protobufs-1.0.0.jar.sha1, modules/transport-grpc/licenses/protobufs-1.1.0.jar.sha1, modules/transport-grpc/spi/licenses/protobufs-1.0.0.jar.sha1, modules/transport-grpc/spi/licenses/protobufs-1.1.0.jar.sha1
Removed SHA1 files for 1.0.0 and added SHA1 files for 1.1.0.
GeoLocation proto API updates
modules/transport-grpc/src/main/java/.../GeoPointProtoUtils.java, modules/transport-grpc/src/test/java/.../GeoPointProtoUtilsTests.java, modules/transport-grpc/src/test/java/.../GeoDistanceQueryBuilderProtoUtilsTests.java, modules/transport-grpc/src/test/java/.../QueryBuilderProtoConverterRegistryTests.java
Replaced hasDoubleArray/getDoubleArray/setDoubleArray(...) with hasCoords/getCoords/setCoords(...) in code and tests.
TermsQuery proto API updates
modules/transport-grpc/src/main/java/.../TermsQueryBuilderProtoUtils.java, modules/transport-grpc/src/test/java/.../TermsQueryBuilderProtoConverterTests.java, modules/transport-grpc/src/test/java/.../TermsQueryBuilderProtoUtilsTests.java, modules/transport-grpc/src/test/java/.../QueryBuilderProtoConverterRegistryTests.java
Replaced FIELD_VALUE_ARRAY/getFieldValueArray()/setFieldValueArray(...) with VALUE/getValue()/setValue(...); adjusted TermsQueryBuilder parsing and error text; added bitmap value handling.
SearchHit proto API updates
modules/transport-grpc/src/main/java/.../SearchHitProtoUtils.java, modules/transport-grpc/src/test/java/.../SearchHitProtoUtilsTests.java
Added HitMatchedQueries construction with conditional setScores(...) or setNames(...), attached via setMatchedQueries2(...); added tests for matched-queries scenarios and removed an unused import.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

dependencies

Suggested reviewers

  • karenyrx
  • msfroh
  • varunbharadwaj
  • reta
  • mch2
  • andrross
  • dbwiddis

Poem

🐰 I hopped through proto fields with cheer,

Coords and values swapped right here,
Checksums moved, tests tuned just so,
Matched queries boxed in a neat row,
A tiny bump — a ribboned go!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: upgrading OpenSearch protobufs to version 1.1.0 in the GRPC module.
Description check ✅ Passed The description includes required sections (Description, Related Issues, Check List) with substantive content covering the protobuf upgrade details, changes made to files, and a comprehensive test plan with gRPC requests and expected responses.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: xil <fridalu66@gmail.com>
Signed-off-by: xil <fridalu66@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

❌ Gradle check result for 4c8005e: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@lucy66hw lucy66hw marked this pull request as ready for review January 9, 2026 01:37
@lucy66hw lucy66hw requested a review from a team as a code owner January 9, 2026 01:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java (1)

103-103: Update error message to use "value" instead of "field_value_array".

This error message still references the old API terminology field_value_array. It should be updated to match the new terminology for consistency with the changes on lines 99 and 147.

📝 Proposed fix
-            throw new IllegalArgumentException("Either field_value_array or lookup must be set");
+            throw new IllegalArgumentException("Either value or lookup must be set");
🤖 Fix all issues with AI agents
In @CHANGELOG.md:
- Line 60: Update the changelog entry that currently reads "Bump
`opensearch-protobufs` from to 1.1.0 and update transport-grpc module
compatibility ([#20396])" to include the missing source version so it reads
"Bump `opensearch-protobufs` from 1.0.0 to 1.1.0 and update transport-grpc
module compatibility ([#20396])", ensuring the version range is complete and
accurate.

In @gradle/libs.versions.toml:
- Line 27: The dependency version for the opensearch protobufs catalog entry
(opensearchprotobufs = "1.1.0") is invalid on Maven Central and will break
Gradle resolution; update the value of the opensearchprotobufs entry in
gradle/libs.versions.toml to "0.24.0" (or the correct published version) or
add/verify the repository that hosts 1.1.0, ensuring the catalog key
opensearchprotobufs matches the published artifact version.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 856c78b and 4c8005e.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • gradle/libs.versions.toml
  • modules/transport-grpc/licenses/protobufs-1.0.0.jar.sha1
  • modules/transport-grpc/licenses/protobufs-1.1.0.jar.sha1
  • modules/transport-grpc/spi/licenses/protobufs-1.0.0.jar.sha1
  • modules/transport-grpc/spi/licenses/protobufs-1.1.0.jar.sha1
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtils.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/GeoDistanceQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoConverterTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java
💤 Files with no reviewable changes (2)
  • modules/transport-grpc/spi/licenses/protobufs-1.0.0.jar.sha1
  • modules/transport-grpc/licenses/protobufs-1.0.0.jar.sha1
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.
📚 Learning: 2026-01-02T19:23:16.689Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:16.689Z
Learning: In OpenSearch's gRPC transport module, treat removals of previously-unsupported fields (those throwing UnsupportedOperationException) from experimental proto schemas as non-breaking changes. When reviewing changes to proto-related Java code in this module, document that such removals do not count as breaking API changes, and ensure tests reflect compatibility expectations accordingly.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoConverterTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/GeoDistanceQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoConverterTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/GeoDistanceQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.

Applied to files:

  • gradle/libs.versions.toml
  • CHANGELOG.md
🔇 Additional comments (14)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtils.java (1)

69-70: LGTM! Protobuf API accessor updated correctly.

The migration from hasDoubleArray()/getDoubleArray() to hasCoords()/getCoords() aligns with the protobuf 1.1.0 API changes. The validation and coordinate parsing logic remains functionally identical.

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java (1)

263-281: LGTM! Matched queries now use structured HitMatchedQueries with setMatchedQueries2().

The implementation correctly builds either a DoubleMap (when scores are included) or a StringArray (names only) based on the includeMatchedQueriesScore flag. This aligns with the protobuf 1.1.0 schema changes and provides better type safety.

Note: Line 261 has a TODO comment indicating that includeMatchedQueriesScore is hardcoded to false. This means matched query scores are currently never included in responses.

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

91-92: LGTM! Enum case and accessor updated from FIELD_VALUE_ARRAY to VALUE.

The migration correctly replaces FIELD_VALUE_ARRAY with VALUE and updates the corresponding accessor from getFieldValueArray() to getValue(). This aligns with the protobuf 1.1.0 API changes.

Also applies to: 139-140


99-99: LGTM! Error messages updated to reflect new API terminology.

The error messages correctly changed from "Neither field_value_array nor lookup is set" to "Neither value nor lookup is set" to match the updated protobuf field names.

Also applies to: 147-147

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/GeoDistanceQueryBuilderProtoUtilsTests.java (1)

144-144: LGTM! Test updated to use setCoords() builder method.

The test correctly uses setCoords() instead of setDoubleArray(), aligning with the protobuf 1.1.0 API changes in GeoPointProtoUtils.java.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java (2)

27-27: LGTM! All test usages updated to setValue() builder method.

All occurrences of setFieldValueArray() have been consistently updated to setValue(), aligning with the protobuf 1.1.0 API changes in TermsQueryBuilderProtoUtils.java. The test coverage remains comprehensive across all scenarios (default behavior, lookup, bitmap types, error cases, etc.).

Also applies to: 85-85, 108-108, 186-186, 211-211, 256-256, 300-301, 344-344, 366-366, 388-388, 406-406, 429-429


1-441: Verify that the protobuf 1.1.0 migration is complete across all production code.

The test file updates appear correct. Ensure no old protobuf 1.0.0 API calls remain in the implementation files (e.g., getDoubleArray(), setDoubleArray(), getFieldValueArray(), setFieldValueArray()) and confirm the opensearch-protobufs dependency in build files has been updated to version 1.1.0 or later.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoConverterTests.java (1)

43-43: LGTM! Protobuf API updates correctly applied.

The test code correctly updates from setFieldValueArray() to setValue() to match the protobufs 1.1.0 API. The test logic remains unchanged and properly validates the TermsQuery conversion behavior.

Also applies to: 92-92, 119-119, 177-177

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryTests.java (2)

460-460: LGTM! GeoLocation API correctly updated.

The test properly updates from setDoubleArray() to setCoords() to align with the protobufs 1.1.0 API rename. The method name better reflects the coordinate semantics.


607-607: LGTM! TermsQueryField API correctly updated.

The test correctly updates from setFieldValueArray() to setValue() to match the protobufs 1.1.0 API. The change aligns with similar updates across other test files.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/common/GeoPointProtoUtilsTests.java (1)

56-56: LGTM! Coordinate API updates consistently applied.

All test methods correctly update from setDoubleArray() to setCoords() to align with the protobufs 1.1.0 API. The comprehensive test coverage for various coordinate scenarios (2D, 3D, dimension validation, z-value handling) remains intact.

Also applies to: 73-73, 93-93, 166-166, 188-188, 209-209

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java (1)

524-544: LGTM! New matched_queries_2 tests are well-structured.

The two new test methods properly validate the matched_queries_2 field behavior introduced in protobufs 1.1.0:

  • testToProtoWithMatchedQueriesScoreFalse correctly verifies the StringArray variant (names without scores)
  • testToProtoWithNoMatchedQueries appropriately tests the absence case

Both tests follow the existing patterns in the file and provide good coverage for the new field.

Note: The existing testToProtoWithMatchedQueries (line 193) still tests the original matched_queries field. If both fields are being maintained for backwards compatibility during a transition period, this is appropriate. Otherwise, you may want to verify whether the old field/test should be deprecated or updated.

modules/transport-grpc/licenses/protobufs-1.1.0.jar.sha1 (1)

1-1: SHA1 hash is consistent with the SPI licenses file.

The hash matches the one in modules/transport-grpc/spi/licenses/protobufs-1.1.0.jar.sha1, which is expected since they reference the same artifact. See the verification script in the SPI file review.

modules/transport-grpc/spi/licenses/protobufs-1.1.0.jar.sha1 (1)

1-1: SHA1 hash is correct and verified. The hash 4d49daae7d84f850a876540ee7b6a979e769d4c7 matches the published org.opensearch:protobufs:1.1.0 artifact on Maven Central.

Signed-off-by: xil <fridalu66@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

❌ Gradle check result for 68b4ee7: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: xil <fridalu66@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java (1)

259-261: Method signature needs updating to support dynamic parameter passing for matched queries scores.

The includeMatchedQueriesScore is hardcoded to false, leaving the scores path (lines 265-271) unreachable. To enable this feature, the processMatchedQueries method signature must be updated to receive search parameters, similar to how SearchHit.toXContent() in the REST implementation does it (see SearchHit.java:734). Additionally, a similar TODO exists in SearchRequestProtoUtils.java:171. This architectural change should be tracked as a follow-up task to complete the protobuf 1.1.0 upgrade, ensuring gRPC responses can optionally include matched query scores via the include_named_queries_score parameter.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68b4ee7 and 992a301.

📒 Files selected for processing (1)
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.

Applied to files:

  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
📚 Learning: 2026-01-02T19:23:16.689Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:16.689Z
Learning: In OpenSearch's gRPC transport module, treat removals of previously-unsupported fields (those throwing UnsupportedOperationException) from experimental proto schemas as non-breaking changes. When reviewing changes to proto-related Java code in this module, document that such removals do not count as breaking API changes, and ensure tests reflect compatibility expectations accordingly.

Applied to files:

  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: gradle-check
  • GitHub Check: precommit (25, macos-15-intel)
  • GitHub Check: precommit (25, ubuntu-latest)
  • GitHub Check: precommit (21, macos-15)
  • GitHub Check: precommit (25, windows-latest)
  • GitHub Check: precommit (21, ubuntu-24.04-arm)
  • GitHub Check: precommit (21, windows-2025, true)
  • GitHub Check: precommit (25, ubuntu-24.04-arm)
  • GitHub Check: precommit (25, macos-15)
  • GitHub Check: precommit (21, macos-15-intel)
  • GitHub Check: precommit (21, windows-latest)
  • GitHub Check: precommit (21, ubuntu-latest)
  • GitHub Check: Analyze (java)
  • GitHub Check: assemble (21, ubuntu-24.04-arm)
  • GitHub Check: assemble (25, windows-latest)
  • GitHub Check: assemble (21, ubuntu-latest)
  • GitHub Check: assemble (21, windows-latest)
  • GitHub Check: assemble (25, ubuntu-24.04-arm)
  • GitHub Check: assemble (25, ubuntu-latest)
  • GitHub Check: detect-breaking-change
🔇 Additional comments (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java (1)

263-286: Backward compatibility strategy is well-implemented.

The approach correctly maintains compatibility:

  • Old clients receive both matched_queries (deprecated) and matched_queries_2.names
  • New clients requesting scores receive only matched_queries_2.scores
  • The deprecated field is populated only when scores are not included, which ensures old clients continue working without modification

This aligns well with the protobuf upgrade objectives and the experimental status of the gRPC API.

Based on learnings, the gRPC API is experimental, so this controlled evolution of the API is appropriate.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

❌ Gradle check result for 992a301: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

✅ Gradle check result for 992a301: SUCCESS

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.16%. Comparing base (62eed1e) to head (ae7b33c).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20396      +/-   ##
============================================
- Coverage     73.23%   73.16%   -0.08%     
+ Complexity    71735    71651      -84     
============================================
  Files          5784     5784              
  Lines        328153   328185      +32     
  Branches      47270    47273       +3     
============================================
- Hits         240333   240122     -211     
- Misses        68498    68840     +342     
+ Partials      19322    19223      -99     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: xil <fridalu66@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java (1)

107-109: Inconsistent error message terminology.

Line 108 still uses the old field_value_array term while line 104 was updated to use value. Update for consistency.

Proposed fix
         if (values == null && termsLookup == null) {
-            throw new IllegalArgumentException("Either field_value_array or lookup must be set");
+            throw new IllegalArgumentException("Either value or lookup must be set");
         }
🧹 Nitpick comments (2)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java (2)

524-535: Consider verifying actual matched query values and backward compatibility.

The test correctly validates the structure of matched_queries_2, but could be more thorough:

  1. Verify the actual string values in the array (not just the count) to catch potential ordering or content issues.
  2. Verify that the deprecated matched_queries field is also populated for backward compatibility, as the implementation populates both fields.
♻️ Suggested enhancements
     public void testToProtoWithMatchedQueriesWithoutScores() throws IOException {
         SearchHit searchHit = new SearchHit(1);
         searchHit.matchedQueries(new String[] { "filter1", "filter2" });
 
         HitsMetadataHitsInner hit = SearchHitProtoUtils.toProto(searchHit);
 
         assertNotNull("Hit should not be null", hit);
         assertTrue("matched_queries_2 should be set", hit.hasMatchedQueries2());
         assertTrue("Should use names (StringArray)", hit.getMatchedQueries2().hasNames());
         assertFalse("Should not use scores (DoubleMap)", hit.getMatchedQueries2().hasScores());
         assertEquals("Should have 2 matched query names", 2, hit.getMatchedQueries2().getNames().getStringArrayCount());
+        assertEquals("First matched query name should match", "filter1", hit.getMatchedQueries2().getNames().getStringArray(0));
+        assertEquals("Second matched query name should match", "filter2", hit.getMatchedQueries2().getNames().getStringArray(1));
+        
+        // Verify backward compatibility with deprecated field
+        assertEquals("Deprecated matched_queries should also have 2 entries", 2, hit.getMatchedQueriesCount());
+        assertEquals("Deprecated first matched query should match", "filter1", hit.getMatchedQueries(0));
+        assertEquals("Deprecated second matched query should match", "filter2", hit.getMatchedQueries(1));
     }

537-544: LGTM! Consider optionally verifying deprecated field.

The negative test correctly validates that matched_queries_2 is not set when there are no matched queries. For completeness, you could also verify that the deprecated matched_queries field is empty (count is 0).

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 992a301 and ae7b33c.

📒 Files selected for processing (4)
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.
📚 Learning: 2026-01-02T19:23:16.689Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:16.689Z
Learning: In OpenSearch's gRPC transport module, treat removals of previously-unsupported fields (those throwing UnsupportedOperationException) from experimental proto schemas as non-breaking changes. When reviewing changes to proto-related Java code in this module, document that such removals do not count as breaking API changes, and ensure tests reflect compatibility expectations accordingly.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java
🧬 Code graph analysis (1)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtilsTests.java (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/response/search/SearchHitProtoUtils.java (1)
  • SearchHitProtoUtils (36-405)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: gradle-check
  • GitHub Check: precommit (21, windows-2025, true)
  • GitHub Check: precommit (25, windows-latest)
  • GitHub Check: precommit (21, macos-15-intel)
  • GitHub Check: precommit (25, macos-15-intel)
  • GitHub Check: precommit (25, ubuntu-24.04-arm)
  • GitHub Check: precommit (25, macos-15)
  • GitHub Check: precommit (21, windows-latest)
  • GitHub Check: precommit (21, macos-15)
  • GitHub Check: precommit (21, ubuntu-latest)
  • GitHub Check: precommit (21, ubuntu-24.04-arm)
  • GitHub Check: Analyze (java)
  • GitHub Check: precommit (25, ubuntu-latest)
  • GitHub Check: assemble (25, ubuntu-24.04-arm)
  • GitHub Check: assemble (21, windows-latest)
  • GitHub Check: assemble (25, windows-latest)
  • GitHub Check: assemble (21, ubuntu-24.04-arm)
  • GitHub Check: assemble (21, ubuntu-latest)
  • GitHub Check: assemble (25, ubuntu-latest)
  • GitHub Check: detect-breaking-change
🔇 Additional comments (2)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/TermsQueryBuilderProtoUtilsTests.java (1)

27-27: Test API updates correctly align with protobuf 1.1.0.

All test usages of TermsQueryField.Builder are correctly updated from setFieldValueArray(...) to setValue(...), matching the renamed proto API. The underlying test logic remains sound, and the comprehensive coverage of scenarios (default behavior, lookups, bitmap encoding, edge cases) is well maintained.

Also applies to: 85-85, 108-108, 186-186, 211-211, 256-256, 300-301, 344-344, 366-366, 388-388, 406-406, 429-429

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

96-104: API updates correctly align with protobuf 1.1.0.

The switch case and getter are properly updated from FIELD_VALUE_ARRAY/getFieldValueArray() to VALUE/getValue(), and the error message at line 104 is updated accordingly.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

✅ Gradle check result for ae7b33c: SUCCESS

@karenyrx karenyrx merged commit d22f8f2 into opensearch-project:main Jan 9, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants