feat(action): add HTTP action implementations for cluster and node APIs#14
Merged
feat(action): add HTTP action implementations for cluster and node APIs#14
Conversation
Implement new HTTP action classes for cluster state, allocation explain, search shards, nodes info/stats/usage, term vectors, multi-term vectors, indices segments/shard stores, recovery, remote info, upgrade, get task, and close index actions. Update HttpClient to wire all new actions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marevol
added a commit
that referenced
this pull request
Mar 22, 2026
Three parse methods introduced in #14 were missing `parser.nextToken()` before calling `consumeObject()` or sub-parse methods when the current token was START_OBJECT. This caused `consumeObject()` to consume tokens beyond its scope (including sibling fields), corrupting the parser state and eventually leading to an infinite loop at EOF — spinning all eshttp threads at 100% CPU each. Fixes: - Add `parser.nextToken()` in parseSearchBackpressureStats, parseTaskCancellationStats, and parseSearchPipelineStats - Add null-token (EOF) guards in fromXContent, parseNodes, parseNodeStats, and consumeObject to throw IOException instead of spinning - Add START_ARRAY handling in consumeObject - Remove orphan `new ArrayList<>()` in parseNodeStats Tests: add 61 unit tests covering token boundary verification, field ordering, multiple nodes, partial sub-fields, deeply nested structures, truncated JSON, and concurrent parsing.
3 tasks
marevol
added a commit
that referenced
this pull request
Mar 22, 2026
* fix: prevent CPU runaway in HttpNodesStatsAction JSON parsing (#18) Three parse methods introduced in #14 were missing `parser.nextToken()` before calling `consumeObject()` or sub-parse methods when the current token was START_OBJECT. This caused `consumeObject()` to consume tokens beyond its scope (including sibling fields), corrupting the parser state and eventually leading to an infinite loop at EOF — spinning all eshttp threads at 100% CPU each. Fixes: - Add `parser.nextToken()` in parseSearchBackpressureStats, parseTaskCancellationStats, and parseSearchPipelineStats - Add null-token (EOF) guards in fromXContent, parseNodes, parseNodeStats, and consumeObject to throw IOException instead of spinning - Add START_ARRAY handling in consumeObject - Remove orphan `new ArrayList<>()` in parseNodeStats Tests: add 61 unit tests covering token boundary verification, field ordering, multiple nodes, partial sub-fields, deeply nested structures, truncated JSON, and concurrent parsing. * fix: handle initial parser state and reduce test log output - Fix fromXContent to call nextToken() when parser is uninitialized (currentToken is null before first read), preventing false EOF detection that broke integration tests - Change test log level from ALL to INFO in 5 integration test classes to reduce output from ~30k lines to ~1k lines for GitHub Actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 14 new HTTP action implementations and updates existing ones to expand the client's coverage of OpenSearch/Elasticsearch APIs.
Changes Made
New action classes:
HttpClusterAllocationExplainAction- Cluster allocation explain APIHttpClusterSearchShardsAction- Search shards APIHttpClusterStateAction- Cluster state APIHttpGetTaskAction- Get task APIHttpIndicesSegmentsAction- Indices segments APIHttpIndicesShardStoresAction- Indices shard stores APIHttpMultiTermVectorsAction- Multi-term vectors APIHttpNodesInfoAction- Nodes info APIHttpNodesUsageAction- Nodes usage APIHttpRecoveryAction- Recovery APIHttpRemoteInfoAction- Remote cluster info APIHttpTermVectorsAction- Term vectors APIHttpUpgradeAction- Upgrade APIHttpUpgradeStatusAction- Upgrade status APIUpdated classes:
HttpClient.java- Wire all new actions into the clientHttpCloseIndexAction.java- Minor updatesHttpGetIndexAction.java- Minor updatesHttpGetMappingsAction.java- Minor updatesHttpNodesStatsAction.java- Enhanced implementationTesting
Tests use Testcontainers with Docker. Run
mvn testto execute integration tests against all supported backend versions.Additional Notes
This significantly increases API coverage for OpenSearch 1.x/2.x/3.x and Elasticsearch 7.x/8.x backends.