Skip to content

Add List Reindex API#140184

Merged
samxbr merged 6 commits intoelastic:mainfrom
samxbr:reindex/add-list-api
Jan 7, 2026
Merged

Add List Reindex API#140184
samxbr merged 6 commits intoelastic:mainfrom
samxbr:reindex/add-list-api

Conversation

@samxbr
Copy link
Contributor

@samxbr samxbr commented Jan 5, 2026

Add a GET /_reindex API to list all running reindex operation. The API is project-scoped (through TransportTasksProjectAction) and only list parent reindex tasks.

Closes https://github.com/elastic/elasticsearch-team/issues/2121

@samxbr samxbr force-pushed the reindex/add-list-api branch 2 times, most recently from bbc0c9a to 6501fd7 Compare January 5, 2026 18:35
@samxbr samxbr force-pushed the reindex/add-list-api branch from 6501fd7 to 5b41d77 Compare January 5, 2026 18:45
@samxbr samxbr added :Distributed/Reindex Issues relating to reindex that are not caused by issues further down >non-issue labels Jan 5, 2026
@samxbr samxbr marked this pull request as ready for review January 5, 2026 22:42
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Indexing (obsolete) Meta label for Distributed Indexing team. Obsolete. Please do not use. label Jan 5, 2026
@elasticsearchmachine
Copy link
Collaborator

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

@samxbr
Copy link
Contributor Author

samxbr commented Jan 6, 2026

I also want to add some multi-project tests to test project isolation. Syzmon is doing something similar in #139211 so holding it for now.

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.

Thanks. Just a few small comments. Nice work!

// Filter for only reindex tasks
if (ReindexAction.NAME.equals(task.getAction()) == false) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

Optional: I think that we could call setActions(ReindexAction.NAME) in the constructor and omit this logic: the super.match call would include it. It would be fractionally slower because that supports simple match patterns on the action names. The benefit is that we're using the mechanism that already exists for filtering by action type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually tried calling setActions(ReindexAction.NAME) in constructor, but that gave a this-escape compilation warning, which I found it weird since setActions is a parent class method. It shouldn't be a concern in this case, and we could add @SuppressWarnings("this-escape") but I am not too happy about suppressing it.

More importantly, since the setActions() method is public, setting it in constructor doesn't give the class a guarantee it won't be overridden externally, so I added this check in the match to ensure the behaviour is correct even if the actions are overridden.

// Filter out subtasks
if (task.getParentTaskId().isSet()) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

(Aside: It's a shame that the base class supports filtering to children of a specific parent, but not filtering only to non-child tasks...)

@samxbr
Copy link
Contributor Author

samxbr commented Jan 7, 2026

I also want to add some multi-project tests to test project isolation. Syzmon is doing something similar in #139211 so holding it for now.

On second thought, I will merge this PR and add MP tests in a separate PR, since some code in this PR can be reused in other places.

@samxbr samxbr merged commit 4261937 into elastic:main Jan 7, 2026
35 checks passed
rjernst pushed a commit to rjernst/elasticsearch that referenced this pull request Jan 7, 2026
szybia added a commit to szybia/elasticsearch that referenced this pull request 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)
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Jan 7, 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.

3 participants