opensearch-java: [BUG] code works with local opensearch but not AOSS
What is the bug?
Using OpenSearchClient.get() to retrieve document. Works with a local opensearch (docker opensearch:2.13.0) but same code fails AOSS (amazon serverless) with 404.
How can one reproduce the bug?
Have example class that can be provided if this is the correct forum.
What is the expected behavior?
I except the same OpenSearchClient.get() to pass or fail independent of local opensearch or AOSS.
What is your host/environment?
Local: docker opensearch 2.13.0 AOSS: unknown
Do you have any screenshots?
No. Would not make sense without seeing the code. Here is the output from the test: local: Index already exists so delete it first local: Created the testing index local: Found expected document local: Found expected document local: Test complete aoss: Index already exists so delete it first aoss: Created the testing index aoss: Found expected document Exception in thread “main” org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [http_exception] server returned 404 at org.opensearch.client.transport.aws.AwsSdk2Transport.parseResponse(AwsSdk2Transport.java:498) at org.opensearch.client.transport.aws.AwsSdk2Transport.executeSync(AwsSdk2Transport.java:396) at org.opensearch.client.transport.aws.AwsSdk2Transport.performRequest(AwsSdk2Transport.java:193) at org.opensearch.client.opensearch.OpenSearchClient.get(OpenSearchClient.java:737) at example.ComparisonLocalVsServerless.doTest(ComparisonLocalVsServerless.java:110) at example.ComparisonLocalVsServerless.main(ComparisonLocalVsServerless.java:79)
Do you have any additional context?
We use cognito to exchange general username/password for access keys. We then use a lambda to convert those keys to AWS credentials because Java SDK does (did not) support cognito at the time of our testing. This lookup is included in the test code.
It seems that the failure seems to be related to the local opensearch using httpclient5 while the AOSS uses httpclient. The document ID that cannot be found contains many : in its name, like a:b:c:d:e::1.0.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34 (20 by maintainers)
Commits related to this issue
- Add failing test for GetRequest w/ AwsSdk2Transport (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to workmanw/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) (#1072) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> — committed to opensearch-project/opensearch-java by workmanw 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) (#1072) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> (cherry picked from commit 5ec233d2547fce86f9b290aed8ec5404ee7f0f97) Signed-off-by: git... — committed to opensearch-project/opensearch-java by github-actions[bot] 2 years ago
- Fix for AwsSdk2Transport error handling (#1068) (#1072) (#1085) (cherry picked from commit 5ec233d2547fce86f9b290aed8ec5404ee7f0f97) Signed-off-by: Wesley Workman <wesleyw@zillowgroup.com> Signed... — committed to opensearch-project/opensearch-java by opensearch-trigger-bot[bot] 2 years ago
Have noted on #1103 that I’m working on a fix for this difference in behaviour
thanks @workmanw and @dblock we will have a look. As @dblock mentioned, looks like the SNAPSHOT builds are failing right now, but we will look to build the code locally and go from there.
Released builds go to https://mvnrepository.com/artifact/org.opensearch.client/opensearch-java and daily SNAPSHOTS go to https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/client/opensearch-java/, so 2.11-SNAPSHOT should be good. I include it in a pom here as an example.
However, looks like the snapshot publication has been intermittently failing, so I am not sure this particular change made it yet, would grok through these builds and see if there’s a successful one after the backport into the 2.x branch. https://github.com/opensearch-project/opensearch-java/actions/workflows/publish-snapshots.yml. I opened https://github.com/opensearch-project/opensearch-java/issues/1090, not sure what’s going on.
I’d appreciate if someone trying this out could add a section to DEVELOPER_GUIDE or expand https://github.com/opensearch-project/opensearch-java/blob/main/README.md#snapshot-builds on how to use SNAPSHOT builds and where they are per above.
@workmanw Yes, would definitely merge with just the integration test.
FWIW I have debugged this already. Apologies if I wasn’t clear above, the problem is that
AwsSdk2Transporthas different response handling thanApacheHttpClient5Transport.If you look here: ApacheHttpClient5Transport.java you’ll see an exception handler for
MissingRequiredPropertyException, this is what ensures that the GetResponse object is deserilaized correctly.Notice that that is missing from AwsSdk2Transport.java.
So I would be happy to fix this issue if you would accept it as having an integration test instead of a unit test. I would be happy to try to write a unit test, but to be honest I don’t have to expertise to take on a large test refactor like you mentioned with #503.
Hi @dblock ,
Sorry for the delay, I was able to add the logs you asked for. Our test script is getting that:
Whereas a document with this id is available in the index: