Skip to content

Add disabled POST _reindex/{taskId}/_cancel API#139211

Merged
szybia merged 28 commits intoelastic:mainfrom
szybia:reindex-cancel-api
Jan 12, 2026
Merged

Add disabled POST _reindex/{taskId}/_cancel API#139211
szybia merged 28 commits intoelastic:mainfrom
szybia:reindex-cancel-api

Conversation

@szybia
Copy link
Contributor

@szybia szybia commented Dec 8, 2025

Closes elastic/elasticsearch-team#2086

@szybia szybia added >non-issue :Distributed/Reindex Issues relating to reindex that are not caused by issues further down labels Dec 9, 2025
@szybia szybia force-pushed the reindex-cancel-api branch from 654cb1d to 10bf116 Compare December 9, 2025 12:12
@szybia szybia marked this pull request as ready for review December 9, 2025 12:20
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Indexing (obsolete) Meta label for Distributed Indexing team. Obsolete. Please do not use. label Dec 9, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)

@szybia
Copy link
Contributor Author

szybia commented Dec 9, 2025

note to self: test that my ITs are skipped in release build by applying label

* upstream/main: (79 commits)
  Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/140_pre_filter_search_shards/prefilter on non-indexed date fields} elastic#139381
  Adjust error bounds for bfloat16 value checks (elastic#139371)
  Unmute some vector CSS tests (elastic#139370)
  Do not allow `project_routing` as a query param (elastic#139206)
  Unmute HalfFloat...Tests#testSynthesizeArrayRandom (elastic#139341)
  Remove leniency in LinkedProjectConfig builder methods (elastic#139012)
  EQL: fix project_routing (elastic#139366)
  Add patch version for 9.2 index version constant (elastic#139362)
  Mute org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT test {p0=search.vectors/200_dense_vector_docvalue_fields/dense_vector docvalues with bfloat16} elastic#139368
  ES|QL: Enable CCS tests for FORK (elastic#139302)
  Restructuring the semantic_text field type page  (elastic#138571)
  AggregateMetricDouble fields should not build BKD indexes (elastic#138724)
  Feature/count by trunc with filter (elastic#138765)
  ESQL: Convert TS 500 error to 400 (elastic#139360)
  [CI] Rerun failing tests for periodic build pipelines (elastic#139200)
  revert muting saml test (elastic#139327)
  Add TDigest histogram as metric (elastic#139247)
  Links solved bugs to class cast exception changelog and unmutes errors (elastic#139340)
  Ensure integer sorts are rewritten to long sorts for BWC indexes (elastic#139293)
  Integrate stored fields format bloom filter with synthetic _id (elastic#138515)
  ...
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new POST /_reindex/{taskId}/_cancel API endpoint for canceling in-flight reindex tasks. The functionality is hidden behind the reindex_resilience feature flag to allow development without affecting releases. The implementation includes transport and REST layers for the cancel operation, with comprehensive integration tests covering synchronous/asynchronous cancellation scenarios.

  • Adds core functionality for a new reindex cancellation API endpoint
  • Implements task filtering logic to validate and cancel reindex tasks
  • Includes end-to-end integration tests for various cancellation scenarios

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Constants.java Adds new reindex cancel action to operator privileges list
TransportCancelReindexAction.java Core transport action implementing reindex task cancellation logic
RestCancelReindexAction.java REST handler for the POST /_reindex/{taskId}/_cancel endpoint
ReindexPlugin.java Registers new action handlers and REST handlers behind feature flag
CancelReindexTaskResponse.java Response object for individual task cancel operations
CancelReindexResponse.java Response object for the cancel API endpoint
CancelReindexRequest.java Request object containing cancellation parameters
ReindexCancelIT.java Integration tests for the cancel endpoint functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* upstream/main: (253 commits)
  Adds ST_SIMPLIFY geo spatial function (elastic#136309)
  Take control of max clause count verification in Lucene searcher (elastic#139752)
  [ML] Unmute Inference Test (elastic#139765)
  Parameterize the vector operation benchmark tests (elastic#139735)
  Fix node reduction pushdown tests for release tests (elastic#139548)
  Fix flakiness in TSDataGenerationHelper (elastic#139759)
  CPS: Copy existing resolved index expressions when constructing a new `SearchRequest` from an existing one (elastic#139596)
  Add release notes for v9.1.9 release (elastic#139674)
  Add lucene query for wildcards on high cardinality keyword fields. (elastic#139746)
  Suppress Tika entitlement warnings from AWT (elastic#139711)
  Check field storage when synthetic source is enabled, in tests (elastic#139715)
  Refactor VectorSimilarityType to know about its corresponding Function (elastic#139678)
  Merge fixes from patch branch back into main (elastic#139721)
  Define native bulk operations for vector square distance (elastic#139198)
  Use LongUpDownCounter for Linked Project Error Metrics (elastic#139657)
  ESQL: Add javadoc that explains version-aware planning (elastic#139706)
  Add helper to pick node for reindex relocation (elastic#139081)
  Fix auth serialization randomized version test (elastic#139182)
  ES|QL - Add parsing, preanalysis and analysis timing information to profile (elastic#139540)
  Mute org.elasticsearch.persistent.ClusterPersistentTasksCustomMetadataTests testMinVersionSerialization elastic#139741
  ...
* upstream/main: (25 commits)
  Add spec for project routing CRUD REST API endpoints (elastic#139634)
  Implement AllSupportedFIeldsTestCase for TDigest (elastic#139744)
  Mute elastic#139802 (elastic#139803)
  fix(logsdb): batch bulk indexing to prevent OOM in challenge tests (elastic#139770)
  Documentation for semantic_text auto pre-filtering (elastic#139749)
  Always do bulk scoring for rescoring when possible (elastic#139777)
  Optimize script sorts that do not require query scores (elastic#139748)
  Bump versions after 9.1.9 release
  Update branches.json for 9.1.9 release
  Bump versions after 9.2.3 release
  Prune changelogs after 8.19.9 release
  Bump versions after 8.19.9 release
  Update branches.json for 8.19.9 release
  Finalize docs for v9.2.3 release (elastic#139795)
  ESQL: Added timezone support to date_format and date_parse (elastic#138517)
  Update branches.json for 9.2.3 release
  Finalize docs for v9.1.9 release (elastic#139796)
  Switch inline stats to GA in docs (elastic#139753)
  Validate license in CPS (elastic#139105)
  FIPS 140-3 support with BC FIPS 2.0.x (elastic#139319)
  ...
@samxbr samxbr mentioned this pull request Jan 6, 2026
szybia added 4 commits January 7, 2026 12:53
* upstream/main: (191 commits)
  Overall Decision for Deciders prioritizes THROTTLE (elastic#140237)
  Apply group by all logic not only to top-level aggregates (elastic#140248)
  [ES|QL] Refactor MV_UNION and MV_INTERSECTION to use shared set operation helper (elastic#139982)
  Avoid reading entire bloom filter file on reader open (elastic#139374)
  Mark bloom filter files for random access (elastic#139375)
  Ensure that the buffer used for ES93BloomFilterStoredFieldsFormat is zeroed (elastic#139034)
  Add busy assertion to avoid race condition for testStalledShardMigrationProperlyDetected (elastic#140230)
  Remove line number check for testTransitiveFindsDeepCallChain (elastic#140228)
  Allow a slight difference in rescored docs (elastic#139931)
  Mute org.elasticsearch.xpack.inference.integration.AuthorizationTaskExecutorIT testCreatesEisChatCompletion_DoesNotRemoveEndpointWhenNoLongerAuthorized elastic#138480
  Start exchange sink fetchers concurrently (elastic#140196)
  Allow allocation to replacement target node on vacate completion (elastic#140150)
  Ignore JNA cleaner threads in SecureHdfsRepositoryAnalysisRestIT (elastic#139925)
  DeterministicQueue refactor and enhancement (elastic#140151)
  Always error out if CCS expression shows up when CCS is not supported (elastic#139009)
  Use IllegalArgumentException over RepositoryException for readonly-repository checks (elastic#140200)
  Guard promql capabilities in AnalyzerTests (elastic#140232)
  [Inference API] Fix flaky AuthorizationTaskExecutorIT tests (elastic#139978)
  Cleaning up exitable vector value impls (elastic#140190)
  [Inference API] Fix auth exception listener not called bug (elastic#139966)
  ...
@szybia szybia added the test-release Trigger CI checks against release build label Jan 7, 2026
* upstream/main:
  Add hook for blocking termination (elastic#133555)
  Delegate to ES93ScalarQuantizedVectorsFormat rather than copying behaviour (elastic#139834)
  Refactor compound block types (elastic#140219)
  Flush the rate buffer when the slice index changes (elastic#138856)
  Log linked project connection errors at debug during shutdown (elastic#140239)
  Periodic FIPS 140-3 buildkite pipelines (elastic#139909)
  ES|QL - Remove TERM function (elastic#139953)
  Fix name of started time field in shutdown status (elastic#139910)
  Drop `project_routing` from query params (elastic#140272)
  Fix flaky test: AllocationDecidersTests (elastic#140271)
  Add List Reindex API (elastic#140184)
  Expose _tier metadata attribute in ESQL (elastic#139894)
  Tweak TSDBRestEsqlIT#testTimeSeriesQuerying(...) (elastic#140210)
  Fix an OOM error when creating to many chained synonym graph token filter. (elastic#140026)
  Suppress Azure SDK error logs (elastic#139730)
  Rewritten integer sorts need to use SortedNumericSortField (elastic#139538) (elastic#139700)
  Adjust index versions for skippers for time series (elastic#139670)
  Fix host.name skippers index version range (elastic#139636)
  Remove BWC shim for a broken commit
  Fix index.mapping.use_doc_values_skipper defaults in serverless (elastic#139532)
@szybia
Copy link
Contributor Author

szybia commented Jan 7, 2026

some release tests are failing that don't seem at all related, and seem to fail on other PRs...

assuming safe to proceed...

@szybia szybia removed the test-release Trigger CI checks against release build label Jan 7, 2026
Copy link
Member

@PeteGillinElastic PeteGillinElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly looking good. There's a couple of small-ish suggestions which occurred to me looking at it with fresh eyes. (You probably want to read the second one first.)

Are you planning on doing the TODOs in this PR or in one or more follow-ups?

@szybia
Copy link
Contributor Author

szybia commented Jan 8, 2026

Are you planning on doing the TODOs in this PR or in one or more follow-ups?

@PeteGillinElastic more follow-ups... i think PR has enough comments

Copy link
Contributor

@samxbr samxbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as follow ups will be done in separate PR

szybia added 6 commits January 9, 2026 19:03
* upstream/main: (76 commits)
  [Inference API] Get _services skips EIS authorization call if CCM is not configured (elastic#139964)
  Improve TSDB codec benchmarks with full encoder and compression metrics (elastic#140299)
  ESQL: Consolidate test `BlockLoaderContext`s (elastic#140403)
  ESQL: Improve Lookup Join performance with CachedDirectoryReader (elastic#139314)
  ES|QL: Add more examples for the match operator (elastic#139815)
  ESQL: Add timezone to add and sub operators, and ConfigurationAware planning support (elastic#140101)
  ESQL: Updated ToIp tests and generated documentation for map parameters (elastic#139994)
  Disable _delete_by_query and _update_by_query for CCS/stateful (elastic#140301)
  Remove unused method ElasticInferenceService.translateToChunkedResults (elastic#140442)
  logging hot threads on large queue of the management threadpool (elastic#140251)
  Search functions docs cleanup (elastic#140435)
  Unmute 350_point_in_time/point-in-time with index filter (elastic#140443)
  Remove unused methods (elastic#140222)
  Add CPS and `project_routing` support for `_mvt` (elastic#140053)
  Streamline `ShardDeleteResults` collection (elastic#140363)
  Fix Docker build to use --load for single-platform images (elastic#140402)
  Parametrize + test VectorScorerOSQBenchmark (elastic#140354)
  `RecyclerBytesStreamOutput` using absolute offsets (elastic#140303)
  Define bulk float native methods for vector scoring (elastic#139885)
  Make `TimeSeriesAggregate` `TimestampAware` (elastic#140270)
  ...
Copy link
Member

@PeteGillinElastic PeteGillinElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, on the proviso that the remaining bits will happen in follow-up PRs. Thanks @szybia !

@szybia szybia merged commit be581a5 into elastic:main Jan 12, 2026
35 checks passed
@szybia szybia deleted the reindex-cancel-api branch January 12, 2026 10:21
jimczi pushed a commit to jimczi/elasticsearch that referenced this pull request Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Reindex Issues relating to reindex that are not caused by issues further down >non-issue Team:Distributed Indexing (obsolete) Meta label for Distributed Indexing team. Obsolete. Please do not use. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants