Add support for Amazon OpenSearch Serverless - #586
Conversation
14e2743 to
8abad24
Compare
|
I have conducted the compatibility test for all OpenSearch APIs called from OpenSearch Hadoop.
20260216UpdateAfter further testing, I found that The The only viable pagination method on Serverless is PIT + Search After API ( |
|
Thanks @lawofcycles for your work on this so far. I see you seem to have patched the sink related API request handling for AOSS mentioned here: #269 (comment) If you could please provide me a build I'd love to test df sink with Glue 4.0 and report back, Gradle is new to me so I haven't been able to build the patch myself. |
|
@achaiban Thank you for your suggestion and sorry for the late response. |
4423c97 to
c1987f9
Compare
7636681 to
65c28df
Compare
65c28df to
e4a7fb8
Compare
|
@Xtansia @harishbhakuni @nknize |
bda9f75 to
daacaee
Compare
Co-authored-by: fukamishuhei <dimorportheca.0407@gmail.com> Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
…rless mode Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
daacaee to
b5e1963
Compare
|
I pushed a new commit to replace Scroll API with Search After API for read pagination in serverless mode.
Tested on EMR 7.12 with a 100,000 doc index on OpenSearch Serverless. Both read and write operations work correctly. Also verified that the standard (non serverless) read/write path is unaffected. Future considerationThe current Search After implementation reuses |
…null for serverless compatibility Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
33cf2e3 to
5473f02
Compare
…issing documents in serverless search_after reads Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
|
I pushed another commit to add PIT (Point in Time) support and a The previous Search After implementation had two issues.
Tested on EMR 7.12 with OpenSearch Serverless and provisioned OpenSearch. |
|
@Xtansia @nknize @harshavamsi I've updated the PR description to reflect the latest changes. Ready for review. |
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
| if (this.settings.getServerlessMode()) { | ||
| // Use a dummy UUID instead of null to avoid NPE in validation | ||
| ClusterName clusterName = new ClusterName("serverless-collection", "serverless-uuid"); | ||
| return new ClusterInfo(clusterName, OpenSearchMajorVersion.V_2_X); |
There was a problem hiding this comment.
So we should definitely upgrade the client to support OS versions 3 and above, but it will be a breaking change that we can address later
There was a problem hiding this comment.
Good catch, I'll raise PR later.
There was a problem hiding this comment.
After looking into this further, the version branching in the codebase is mostly limited to the type/typeless API distinction (V_1_X vs V_2_X+), and V_3_X is already defined and parseable in OpenSearchMajorVersion. Since Serverless does not expose its internal OpenSearch version through GET /, it is unclear what version should be returned here.
The current V_2_X works correctly because all existing version branches treat V_2_X and above identically (typeless path). I think we can revisit this when a concrete incompatibility surfaces, either from Serverless behavior changes.
| // try first a blind delete by query | ||
| try { | ||
| Resource res = resources.getResourceWrite(); | ||
| client.deleteByQuery( | ||
| res.isTyped() | ||
| ? res.index() + "/" + res.type() | ||
| : res.index(), | ||
| MatchAllQueryBuilder.MATCH_ALL); | ||
| } catch (OpenSearchHadoopInvalidRequest ehir) { | ||
| log.error("Delete by query was not successful...", ehir); |
There was a problem hiding this comment.
does serverless not support delete?
There was a problem hiding this comment.
nvm, saw the description
|
@harshavamsi Critical fixes:
Minor improvement:
All verified on EMR 7.12 + OpenSearch Serverless. Would appreciate a review when you get a chance. |
|
Hi @harshavamsi, Thanks a lot for adding support for OpenSearch Serverless - this is really appreciated. I just wanted to check when this change is expected to be included in a Maven release and which version it will be part of. At the moment, the latest version available on Maven Central is 1.3.0: It would be helpful to know when a new release including this PR might be published. |
|
@advaitpathak-cod If you need a version with serverless support before that, I can show you how to build the jar. |
Thanks @lawofcycles for the update. |
Description
Add support for Amazon OpenSearch Serverless.
When
opensearch.serverless=trueis set, opensearch-hadoop works in serverless mode, connecting to serverless endpoints and calling APIs based on serverless specs.How it works
Write path: Adapted to Serverless APIs. Cluster health checks, refresh calls, and node discovery are skipped since these endpoints are not available on Serverless.
ClusterInfois synthesized locally without callingGET /.Read path: Uses PIT (Point in Time) + Search After API for pagination. Scroll API and Slice API are not available on Serverless, so all reads go through a single partition per index. PIT ensures snapshot consistency during reads, and
_idis used as a sort tiebreaker to prevent missing documents.POST /_search/scrollPOST /<index>/_search/point_in_timesliceparametersearch_after+pitConfiguration
opensearch.serverlessfalseopensearch.pit.keepalive5mopensearch.nodes.wan.onlytrueExample
Write
Read
Future consideration
The current Search After implementation reuses
ScrollReaderandScrollQuerywith a serverless mode flag. Ideally, the pagination logic (ScrollQuery) should be split into separateScrollPaginationQueryandSearchAfterPaginationQueryimplementations, with the common hit parsing logic inScrollReaderextracted into a shared base. However,ScrollReader.read()contains complex parsing, raw JSON reconstruction, and metadata extraction that accounts for the majority of the code, while the Scroll/SearchAfter divergence is limited to response header handling and a few lines of state management. Restructuring this carries regression risk disproportionate to the benefit, so this refactoring is left for a future PR.Testing
Tested on EMR 7.12 with Spark, Hive, and MapReduce against OpenSearch Serverless. Also verified that the standard (non serverless) read/write path is unaffected.
Co-authored-by: @dimorportheca47
Issues Resolved
fix #269
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.