Elasticsearch Elasticsearch Long Running Reindex Task

By Opster Team

Updated: Mar 10, 2024

| 2 min read

What does this mean? 

A long running reindex task in Elasticsearch refers to a reindexing process that is taking an unusually long time to complete. Reindexing is the process of copying data from one index to another, usually with some modifications. This event indicates that the reindexing process is taking longer than expected, which may affect the overall performance of the Elasticsearch cluster.

Why does this occur?

There could be several reasons for a long running reindex task in Elasticsearch. Some of the common reasons include:

  1. Large volume of data: If the index being reindexed contains a large amount of data, the reindexing process may take longer to complete.
  2. Complex mappings and analysis: If the index has complex mappings and analysis configurations, the reindexing process may require more time to process the data.
  3. Insufficient resources: If the Elasticsearch cluster does not have enough resources (CPU, memory, or disk space), the reindexing process may be slow.
  4. High refresh interval: A high refresh interval can cause the reindexing process to take longer, as the index needs to be refreshed more frequently.

Possible impact and consequences of long running reindex tasks

The impact of a long running reindex task in Elasticsearch can be significant. Some of the possible consequences include:

  1. Reduced cluster performance: A long running reindex task can consume a significant amount of resources, which may affect the overall performance of the Elasticsearch cluster.
  2. Delayed updates: If the reindexing process takes too long, updates to the index may be delayed, leading to outdated search results.
  3. Increased load on the cluster: A long running reindex task can increase the load on the Elasticsearch cluster, potentially causing other tasks to be delayed or fail.

How to resolve

To resolve the issue of a long running reindex task in Elasticsearch, consider the following recommendations:

1. Improve the long reindex tasks: Sliced scroll is supported in order to parallelize the reindexing process. This parallelization can improve efficiency and provide a convenient way to break the request into smaller parts. Use the following command to enable sliced scroll:

POST _reindex?wait_for_completion=false&slices=5
  "source": {
    "index": "source_index"
  "dest": {
    "index": "destination_index"

2. Use the Elasticsearch Task Management API to monitor the progress of the reindex task and identify any bottlenecks or issues. The response from the previous command will include a <task_id> that you can use to monitor the progress of the reindexing task using the command below:

GET _tasks/<task_id>

3. Increase the refresh interval if applicable: If the refresh interval of the destination index is currently less than 30 seconds, increase it to 30 seconds using the following command:

PUT /destination_index/_settings
  "index" : {
    "refresh_interval" : "30s"

4. Review the index mappings and analysis, and optimize where possible: Analyze the index mappings and analysis configurations to identify any areas that can be optimized to improve the reindexing process. You can use the free Opster Template Analyzer tool to help you with this.

5. Allocate more resources to the Elasticsearch cluster: If the cluster is running low on resources, consider adding more nodes or increasing the resources allocated to the existing nodes.

6. Ultimately, if you think that the reindexing task is stuck or has been running for too long, you can use the following command to kill it:

POST /_tasks/<task_id>/_cancel