Skip to content

feat(action): add HTTP action implementations for cluster and node APIs#14

Merged
marevol merged 2 commits intomainfrom
feat/add-http-action-implementations
Mar 14, 2026
Merged

feat(action): add HTTP action implementations for cluster and node APIs#14
marevol merged 2 commits intomainfrom
feat/add-http-action-implementations

Conversation

@marevol
Copy link
Contributor

@marevol marevol commented Mar 14, 2026

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 API
  • HttpClusterSearchShardsAction - Search shards API
  • HttpClusterStateAction - Cluster state API
  • HttpGetTaskAction - Get task API
  • HttpIndicesSegmentsAction - Indices segments API
  • HttpIndicesShardStoresAction - Indices shard stores API
  • HttpMultiTermVectorsAction - Multi-term vectors API
  • HttpNodesInfoAction - Nodes info API
  • HttpNodesUsageAction - Nodes usage API
  • HttpRecoveryAction - Recovery API
  • HttpRemoteInfoAction - Remote cluster info API
  • HttpTermVectorsAction - Term vectors API
  • HttpUpgradeAction - Upgrade API
  • HttpUpgradeStatusAction - Upgrade status API

Updated classes:

  • HttpClient.java - Wire all new actions into the client
  • HttpCloseIndexAction.java - Minor updates
  • HttpGetIndexAction.java - Minor updates
  • HttpGetMappingsAction.java - Minor updates
  • HttpNodesStatsAction.java - Enhanced implementation

Testing

Tests use Testcontainers with Docker. Run mvn test to 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.

marevol and others added 2 commits March 14, 2026 17:29
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 marevol merged commit 524dac4 into main Mar 14, 2026
1 check passed
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.
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
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.

1 participant