Skip to content

Adding get migration reindex status#118267

Merged
elasticsearchmachine merged 14 commits intoelastic:mainfrom
masseyke:adding-get-migration-reindex-status
Dec 10, 2024
Merged

Adding get migration reindex status#118267
elasticsearchmachine merged 14 commits intoelastic:mainfrom
masseyke:adding-get-migration-reindex-status

Conversation

@masseyke
Copy link
Member

@masseyke masseyke commented Dec 9, 2024

This adds a new transport action to get the status of a migration reindex (started via the API at #118109), and a new rest action to use it. The rest action accepts the data stream or index name, and returns the status. For example if the reindex task exists for data stream my-data-stream:

GET /_migration/reindex/my-data-stream/_status?pretty

returns

{
  "start_time" : 1733519098570,
  "complete" : true,
  "total_indices" : 1,
  "total_indices_requiring_upgrade" : 0,
  "successes" : 0,
  "in_progress" : 0,
  "pending" : 0,
  "errors" : [ ]
}

If a reindex task does not exist:

GET _migration/reindex/my-data-stream/_status?pretty

Then a 404 is returned:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "resource_not_found_exception",
        "reason" : "No migration reindex status found for [my-data-stream]"
      }
    ],
    "type" : "resource_not_found_exception",
    "reason" : "No migration reindex status found for [my-data-stream]"
  },
  "status" : 404
}
@masseyke masseyke added >enhancement :StorageEngine/Data streams Data streams and their lifecycles auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 labels Dec 9, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @masseyke, I've created a changelog YAML for you.

@masseyke masseyke marked this pull request as ready for review December 9, 2024 15:36
@elasticsearchmachine elasticsearchmachine added the Team:Data Management (obsolete) DO NOT USE. This team no longer exists. label Dec 9, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

"indices:admin/cache/clear",
"indices:admin/data_stream/lazy_rollover",
"indices:admin/data_stream/reindex",
"indices:admin/data_stream/reindex_status",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be indices:admin/migration/reindex_status to match the action name?

More generally, do we want to change the existing related transport actions to migration/...? Though I'm this may not even be possible without a bunch of careful version juggling?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah good point. I think it's fine to do at this point because (1) the code is inaccessible in serverless and (2) it wasn't in 8.17 so it has not made it into any release yet.

Copy link
Contributor

@parkertimmins parkertimmins left a comment

Choose a reason for hiding this comment

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

looks good to me!

@masseyke masseyke added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Dec 9, 2024
@elasticsearchmachine elasticsearchmachine merged commit ae598ee into elastic:main Dec 10, 2024
@masseyke masseyke deleted the adding-get-migration-reindex-status branch December 10, 2024 16:34
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Dec 10, 2024
This adds a new transport action to get the status of a migration
reindex (started via the API at elastic#118109), and a new rest action to use
it. The rest action accepts the data stream or index name, and returns
the status. For example if the reindex task exists for data stream
`my-data-stream`:

```
GET /_migration/reindex/my-data-stream/_status?pretty
```

returns

```
{
  "start_time" : 1733519098570,
  "complete" : true,
  "total_indices" : 1,
  "total_indices_requiring_upgrade" : 0,
  "successes" : 0,
  "in_progress" : 0,
  "pending" : 0,
  "errors" : [ ]
}
```

If a reindex task does not exist:

```
GET _migration/reindex/my-data-stream/_status?pretty
```

Then a 404 is returned:

```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "resource_not_found_exception",
        "reason" : "No migration reindex status found for [my-data-stream]"
      }
    ],
    "type" : "resource_not_found_exception",
    "reason" : "No migration reindex status found for [my-data-stream]"
  },
  "status" : 404
}
```
elasticsearchmachine pushed a commit that referenced this pull request Dec 10, 2024
* Adding get migration reindex status (#118267)

This adds a new transport action to get the status of a migration
reindex (started via the API at #118109), and a new rest action to use
it. The rest action accepts the data stream or index name, and returns
the status. For example if the reindex task exists for data stream
`my-data-stream`:

```
GET /_migration/reindex/my-data-stream/_status?pretty
```

returns

```
{
  "start_time" : 1733519098570,
  "complete" : true,
  "total_indices" : 1,
  "total_indices_requiring_upgrade" : 0,
  "successes" : 0,
  "in_progress" : 0,
  "pending" : 0,
  "errors" : [ ]
}
```

If a reindex task does not exist:

```
GET _migration/reindex/my-data-stream/_status?pretty
```

Then a 404 is returned:

```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "resource_not_found_exception",
        "reason" : "No migration reindex status found for [my-data-stream]"
      }
    ],
    "type" : "resource_not_found_exception",
    "reason" : "No migration reindex status found for [my-data-stream]"
  },
  "status" : 404
}
```

* adding migration reindex actions to OperatorPrivilegesIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >enhancement :StorageEngine/Data streams Data streams and their lifecycles Team:Data Management (obsolete) DO NOT USE. This team no longer exists. v8.18.0 v9.0.0

3 participants