Type to search.

Long running search task

ECH

Elastic Cloud Hosted lets you manage and configure one or more deployments of the versioned Elastic Stack, hosted on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

ECK

Elastic Cloud on Kubernetes extends Kubernetes orchestration capabilities to allow you to deploy and manage components of the Elastic Stack.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

ECE

Elastic Cloud Enterprise is a self-managed orchestration platform for deploying and managing the Elastic Stack at scale.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Self-managed

Self-managed deployments are Elastic Stack deployments managed without the assistance of an orchestrator.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

A search task has remained active beyond your configured runtime threshold. Long searches often reflect broad queries, large result sizes, expensive aggregations, or scans with weak filters.

Note

For a complete list of insights, refer to AutoOps insights.

Field Value
Component Elasticsearch
Severity Medium
Scope Node
Domains performance, search, stability, tasks

You can customize these settings to adjust when AutoOps detects this event and presents the insight. Refer to AutoOps event settings for details.

The default customization settings are:

Setting Type Default
Long running search task threshold in minutes Integer 1

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.

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.

Note

AutoOps shows different recommendations depending on how their conditions match your deployment or cluster.

Improve search query

Condition: Shown when search task is not cancellable.

Review the long-running search in slow logs or task details, then optimize the query, filters, or scope so it finishes within an acceptable time.

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
POST _tasks/es-data-01:4521, es-data-02:7788/_cancel
Note

Requires the manage cluster privilege. Requires Elasticsearch 8.0.0 or later. This action changes cluster or index configuration.

Search tasks run on dedicated thread pools and use heap for query execution, aggregations, and result materialization. When a search runs longer than expected, it ties up resources that other clients need on the same nodes.

Common contributors include very large result sizes, queries over broad index or time ranges without tight filters, expensive aggregations, regex or leading-wildcard patterns, and scripting. If long searches persist, search latency and rejection rates on affected nodes can increase.

Tune for search speed