Skip to content

fix(action): forward dropped request params and fix wait_for_active_shards serialization#31

Merged
marevol merged 2 commits into
mainfrom
fix/action-request-param-correctness
Jul 8, 2026
Merged

fix(action): forward dropped request params and fix wait_for_active_shards serialization#31
marevol merged 2 commits into
mainfrom
fix/action-request-param-correctness

Conversation

@marevol

@marevol marevol commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Correctness fixes to existing HTTP actions, continuing the request-parameter
serialization work from #30. Each fix was verified against the corresponding
OpenSearch Rest*Action. No new dependencies; no API changes.

Fixes

  • HttpOpenIndexActionwait_for_active_shards for ActiveShardCount.ALL
    now serializes to "all" instead of "ALL" (the server rejects the latter
    with HTTP 400). This is the same bug class fixed centrally in feat(client): add PIT, reindex/by-query, resolve-index actions and fix request-param serialization #30; this was the
    one remaining call site still using ActiveShardCount.toString(). Also forwards
    indices options.
  • HttpCloseIndexAction — forwards wait_for_active_shards and indices
    options, both of which were dropped (close could otherwise return before shards
    were ready).
  • HttpUpdateAction — removes the version / version_type params. The
    _update endpoint rejects internal versioning (it requires if_seq_no /
    if_primary_term, already sent), and UpdateRequest's version setters throw
    UnsupportedOperationException, so the removed block was unreachable.
  • HttpIndicesAliasesAction — builds the request body from the request's own
    toXContent, so is_write_index, is_hidden, must_exist and routing are
    now emitted (a write-index alias was previously not marked as such), and a
    remove_index action no longer emits a bogus empty aliases.
  • HttpRefreshAction / HttpFlushAction / HttpForceMergeAction /
    HttpDeleteIndexAction / HttpGetMappingsAction
    — forward indices options
    (ignore_unavailable, allow_no_indices, expand_wildcards).
  • HttpForceMergeAction — also forwards primary_only.

Testing

  • Adds unit tests asserting the emitted query params / body for each fix, using
    the existing ActionTestUtils offline CurlRequest inspection.
  • Full unit suite: 301 tests pass (mvn test excluding the Docker /
    Testcontainers *ClientTest integration classes). The container-based
    integration tests should be run in CI to validate end-to-end.

marevol added 2 commits July 7, 2026 23:39
…hards serialization

Correctness fixes to existing HTTP actions, verified against the OpenSearch
REST layer. No new dependencies and no API changes.

- HttpOpenIndexAction: serialize wait_for_active_shards ActiveShardCount.ALL as
  "all" (was "ALL", which the server rejects with HTTP 400) and forward indices
  options. This was the remaining call site still using ActiveShardCount.toString().
- HttpCloseIndexAction: forward wait_for_active_shards and indices options
  (both were dropped, so close could return before shards were ready).
- HttpUpdateAction: remove version/version_type params. The _update endpoint
  rejects internal versioning (it uses if_seq_no/if_primary_term, already sent),
  and UpdateRequest's version setters throw UnsupportedOperationException, so the
  removed block was unreachable.
- HttpIndicesAliasesAction: build the request body via the request's own
  toXContent so is_write_index/is_hidden/must_exist/routing are emitted and a
  remove_index action no longer emits an empty "aliases".
- HttpRefreshAction, HttpFlushAction, HttpForceMergeAction, HttpDeleteIndexAction,
  HttpGetMappingsAction: forward indices options (ignore_unavailable,
  allow_no_indices, expand_wildcards).
- HttpForceMergeAction: also forward primary_only.

Adds unit tests asserting the emitted query params / body for each fix.
… later

primary_only is unknown to OpenSearch 1.x and Elasticsearch 7/8, which reject
unrecognized query parameters with HTTP 400 (the test_force_merge integration
tests failed on those engines). Gate the parameter on the detected engine type,
matching the version-conditional pattern already used by HttpGetMappingsAction.

ActionTestUtils now stubs getEngineInfo() (with a per-engine-type overload) so
version-conditional serialization can be asserted offline; HttpForceMergeActionTest
covers both the OpenSearch 2.x/3.x (sent) and legacy (omitted) branches.
@marevol marevol merged commit 70dacf9 into main Jul 8, 2026
1 check passed
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