﻿---
title: Long Running Index task
description: Describes what AutoOps detects and surfaces with the Long Running Index task insight: An individual indexing task has run longer than expected.
url: https://docs-v3-preview.elastic.dev/elastic/autoops-insights/tree/main/elasticsearch/long_running_index_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 Index task
An individual indexing task has run longer than expected. Single-document indexing can stall when documents are large, mappings must update, ingest pipelines are heavy, or nodes are under resource pressure.
<note>
  For a complete list of insights, refer to [AutoOps insights](https://docs-v3-preview.elastic.dev/elastic/autoops-insights/tree/main/elasticsearch).
</note>


## Insight details


| Field     | Value                                   |
|-----------|-----------------------------------------|
| Component | Elasticsearch                           |
| Severity  | Medium                                  |
| Scope     | Node                                    |
| Domains   | performance, indexing, 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-v3-preview.elastic.dev/elastic/docs-content/tree/main/deploy-manage/monitor/autoops/ec-autoops-event-settings) for details.
The default customization settings are:

| Setting                                      | Type    | Default |
|----------------------------------------------|---------|---------|
| Long running index task threshold in minutes | Integer | 1       |


## 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 index task


#### What was detected

Summary: 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 420 ms. ACTIVE TASKS: NodeName: logs-prod-000045- TaskId:es-data-01:4521
TaskSerialNumber:12
TaskType:logs-prod-000045
Description:bulk index to logs-prod-000045
StartTimeInMillis:1710502920000
RunningTimeInMinutes:48
Cancellable:true
Action:indices:data/write/bulk
Headers:{} HISTORY TASKS: NodeName:logs-prod-000045- TaskId:es-data-01:4521
TaskSerialNumber:12
TaskType:logs-prod-000045
Description:bulk index to logs-prod-000045
StartTimeInMillis:1710502920000
RunningTimeInMinutes:48
Cancellable:true
Action:indices:data/write/bulk
Headers:{}

#### 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 one or more long-running tasks are 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>


#### Background and impact

Impact: Long running indexing tasks might affect the cluster performance. Long running indexing tasks are usually a side-effect of constrained resources, most of the time high load, memory pressure or limited CPU availability. There can be various reasons why a task in charge of indexing a single document takes an unusual amount of time to complete, namely when the document being indexed satisfies one or more of the following conditions:
1. it is very large
2. it contains a large amount of deeply nested elements
3. it requires a mapping change (that is, new field) and the elected master node is too overloaded to broadcast the mapping change to all data nodes
4. it needs to go through an ingest pipeline and the ingest node running the pipeline doesn't have sufficient resources
5. it needs to go through an inference processor and the machine learning node hosting the trained model doesn't have sufficient resources For these reasons, there are a few best practices to keep in mind:
6. Stay on top of your index mappings, do not index too many useless fields
7. Make sure your documents have a reasonable size and if you need to index large chunks of text that either need to be analyzed or vectorized, consider splitting them into several documents
8. Try to not misuse nested fields and denormalize your documents as much as possible
9. If you leverage ingest pipelines that contain potentially heavy processors, such as inference, scripts, grok, enrich, and so on, pay special attention to optimize them as much as possible.