Skip to content

Route getNotificationConfigs through SdkClient - #1225

Open
MohammedAghil wants to merge 1 commit into
opensearch-project:mainfrom
MohammedAghil:fix/search-based-multiget
Open

Route getNotificationConfigs through SdkClient#1225
MohammedAghil wants to merge 1 commit into
opensearch-project:mainfrom
MohammedAghil:fix/search-based-multiget

Conversation

@MohammedAghil

@MohammedAghil MohammedAghil commented May 6, 2026

Copy link
Copy Markdown
Contributor

Description

Route getNotificationConfigs through SdkClient by replacing MultiGetRequest with SearchDataObjectRequest using idsQuery

This is the only remaining operation in NotificationConfigIndex that bypassed the Remote Metadata SDK, going directly to the local OpenSearch client. The send notification flow calls this method to bulk-fetch channel configs before sending notifications, which fails when using a remote metadata backend with other metadata stores.
The fix is consistent with how getAllNotificationConfigs already performs searches through SdkClient.searchDataObjectAsync().

Related Issues

Resolves #1224

Build Run

> Task :opensearch-notifications-core:generatePomFileForPluginZipPublication
> Task :opensearch-notifications-core:validateNebulaPom SKIPPED
> Task :opensearch-notifications-core:validatePluginZipPom UP-TO-DATE
> Task :opensearch-notifications-core:validatePom UP-TO-DATE
> Task :opensearch-notifications-core:precommit UP-TO-DATE
> Task :opensearch-notifications-core:test
> Task :opensearch-notifications-core:javaRestTest NO-SOURCE
> Task :opensearch-notifications-core-spi:jar UP-TO-DATE
> Task :opensearch-notifications-core-spi:compileTestKotlin UP-TO-DATE
> Task :opensearch-notifications-core-spi:compileTestJava NO-SOURCE
> Task :opensearch-notifications-core-spi:processTestResources NO-SOURCE
> Task :opensearch-notifications-core-spi:testClasses UP-TO-DATE
> Task :opensearch-notifications-core-spi:precommit UP-TO-DATE
> Task :opensearch-notifications-core-spi:test
> Task :opensearch-notifications-core-spi:javadoc NO-SOURCE
> Task :opensearch-notifications-core-spi:check
> Task :notifications:generatePom
> Task :notifications:assemble
> Task :opensearch-notifications-core:generatePom
> Task :opensearch-notifications-core:assemble
> Task :opensearch-notifications-core-spi:assemble UP-TO-DATE
> Task :opensearch-notifications-core-spi:build
> Task :opensearch-notifications-core:jacocoTestReport
> Task :opensearch-notifications-core:check
> Task :opensearch-notifications-core:build
> Task :notifications:jacocoTestReport
> Task :notifications:check
> Task :notifications:build
> Task :opensearch-notifications-core-spi:jacocoTestReport
> Task :jacocoReport SKIPPED
> Task :check
> Task :build

[Incubating] Problems report is available at: file:///workplace/aghilp/notifications-private-remote/notifications/notifications/build/reports/problems/problems-report.html

Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/9.4.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 3m 33s
54 actionable tasks: 13 executed, 41 up-to-date

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

null
}
}
return response.responses.mapNotNull { parseNotificationConfigDoc(it.id, it.response) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the existing parse method not able to handle the search response?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

currently parseNotificationConfigDoc takes a GetResponse, but the search returns SearchHit objects. The SearchHit has sourceAsString but not a GetResponse, so we can't pass it directly

@AWSHurneyt AWSHurneyt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you add unit/integ tests?

Also, it looks like the github workflows are failing for this PR. Could you take a look?

.timeout(TimeValue(PluginSettings.operationTimeoutMs, TimeUnit.MILLISECONDS))
.query(QueryBuilders.idsQuery().addIds(*ids.toTypedArray()))
.size(ids.size)
val searchRequest = SearchDataObjectRequest.builder()

@AWSHurneyt AWSHurneyt May 13, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see that getAllNotificationConfigs adds the tenantId to the search request. Is it intentional to exclude that from this search request?

val sourceBuilder = SearchSourceBuilder()
.timeout(TimeValue(PluginSettings.operationTimeoutMs, TimeUnit.MILLISECONDS))
.query(QueryBuilders.idsQuery().addIds(*ids.toTypedArray()))
.size(ids.size)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is probably an unlikely edge case, but do we need to worry about ids.size being greater than 10k in this situation? Or does searchDataObjectAsync not have that limitation?

@MohammedAghil
MohammedAghil force-pushed the fix/search-based-multiget branch from 77f54fb to 265bd10 Compare May 13, 2026 21:06
distributionPath=wrapper/dists
distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wouldnt there be a new gradle wrapper jar?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@MohammedAghil could you take a look at this gradle bump PR for the alerting plugin? you may be able to just copy those changes.
https://github.com/opensearch-project/alerting/pull/2122/changes

…K compatibility (opensearch-project#1224)

Replace MultiGetRequest with SearchDataObjectRequest using idsQuery to ensure
bulk config fetches go through SdkClient, consistent with all other operations.

- Added tenantId to search request for multi-tenancy support
- Updated gradle wrapper to 9.4.1 (required by OpenSearch gradle plugin)

Signed-off-by: Mohammed Aghil Puthiyottil <57040494+MohammedAghil@users.noreply.github.com>
@MohammedAghil
MohammedAghil force-pushed the fix/search-based-multiget branch from 265bd10 to 53eb0d5 Compare May 13, 2026 21:51
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.

Route getNotificationConfigs through SdkClient for remote metadata SDK compatibility

5 participants