﻿---
title: Long running shard task
description: Describes what AutoOps detects and surfaces with the Long running shard task insight: A shard-level task such as recovery, relocation, or initialization has run longer than your configured threshold.
url: https://www.elastic.co/docs/reference/autoops-insights/elasticsearch/long_running_shard_task
products:
  - Elastic Cloud Enterprise
  - Elastic Cloud Hosted
  - Elastic Cloud on Kubernetes
  - Elasticsearch
applies_to:
  - Elastic Cloud Hosted: Generally available
  - Elastic Cloud on Kubernetes: Generally available
  - Elastic Cloud Enterprise: Generally available
  - Self-managed Elastic deployments: Generally available
---

# Long running shard task
A shard-level task such as recovery, relocation, or initialization has run longer than your configured threshold. Shard work is normal after topology changes, snapshot restores, or replica adjustments, but very large shards or many concurrent movements prolong it.
<note>
  For a complete list of insights, refer to [AutoOps insights](https://www.elastic.co/docs/reference/autoops-insights/elasticsearch).
</note>


## Insight details


| Field     | Value                                           |
|-----------|-------------------------------------------------|
| Component | Elasticsearch                                   |
| Severity  | Medium                                          |
| Scope     | Node                                            |
| Domains   | performance, shard-allocation, stability, tasks |


## Customization settings

You can customize these settings to adjust when AutoOps detects this event and presents the insight. Refer to [AutoOps event settings](https://docs-edge.elastic.dev/docs/deploy-manage/monitor/autoops/ec-autoops-event-settings) for details.
The default customization settings are:

| Setting                                      | Type    | Default |
|----------------------------------------------|---------|---------|
| Long running shard task threshold in minutes | Integer | `60`    |


## Example: What you might see in AutoOps

The following is an example of what you might see when this insight is triggered. Real insights use live data and links from your deployment or cluster.

### Long running shard task


#### What was detected

There are 3 tasks that ran more than the 12 minutes threshold.
The longest task running start time was 2026-03-15T14:22:00 UTC time.
The longest task running time is 48 minutes.

#### Recommendations

<note>
  AutoOps shows different recommendations depending on how their conditions match your deployment or cluster.
</note>

<dropdown title="Cancel long-running tasks">
  **Condition**: Shown when cancellable.Cancel long-running tasks (es-data-01:4521, es-data-02:7788) that are affecting cluster stability. Use the action below.
  ```json
  ```

  <note>
    Requires the `manage cluster` privilege. Requires Elasticsearch 8.0.0 or later. This action changes cluster or index configuration.
  </note>
</dropdown>

<dropdown title="Fix non-cancellable shard tasks">
  **Condition**: Shown when not cancellable.Balance or reroute shards during off-peak hours, or reduce cluster load so long-running shard recovery and relocation can finish.
</dropdown>

<dropdown title="Fix non-cancellable shard tasks">
  **Condition**: Shown when shard task is not cancellable.Balance or reroute shards during off-peak hours, or add or remove nodes so long-running shard tasks can finish.
</dropdown>


#### Background and impact

Shard allocation and relocation keep data balanced across nodes. Recovery, relocation, and initialization tasks copy shard data over the network and disk when cluster topology or shard placement changes.
Large shards, many concurrent movements, or cluster resource pressure extend these tasks. When shard work runs long, disk and network utilization rise and cluster balance can stall until the tasks finish.

## Guide

[Shard allocation, relocation, and recovery](https://docs-edge.elastic.dev/docs/deploy-manage/distributed-architecture/shard-allocation-relocation-recovery)