DeleteByQuery for state timed out – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.5-8.9

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.

Briefly, this error occurs when the DeleteByQuery operation in Elasticsearch takes longer than the set timeout period. This could be due to a large amount of data being processed, slow network, or insufficient resources. To resolve this issue, you can increase the timeout period, optimize your query to make it more efficient, or scale up your Elasticsearch cluster to provide more resources. Additionally, consider breaking down your query into smaller parts to reduce the load on the system.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” [{}] DeleteByQuery for state timed out ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, delete, query.

Log Context

Log “[{}] DeleteByQuery for state timed out” classname is
We extracted the following from Elasticsearch source code for those seeking an in-depth context :


        // Step 2. Delete job docs from stats index
        ActionListener deleteStateHandler = ActionListener.wrap(bulkByScrollResponse -> {
            if (bulkByScrollResponse.isTimedOut()) {
                logger.warn("[{}] DeleteByQuery for state timed out"; id);
            if (bulkByScrollResponse.getBulkFailures().isEmpty() == false) {
                    "[{}] {} failures and {} conflicts encountered while running DeleteByQuery for state";


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?