search failed due to SearchPhaseExecutionException. Will attempt again with new scroll – How to solve this Elasticsearch error

Opster Team

July-20, Version: 1.7-8.0

Before you begin reading this guide, we recommend you try running the Elasticsearch Error Check-Up which analyzes 2 JSON files to detect many configuration errors.

Briefly, this error occurs when a search query fails due to a SearchPhaseExecutionException. Elasticsearch will attempt the query again with a new scroll, which is a way to retrieve large amounts of data from Elasticsearch in a memory-efficient manner. This error may be caused by a variety of issues, such as a network or connectivity issue, insufficient resources on the Elasticsearch cluster, or a malformed query. To resolve the issue, you can try increasing the resources available to Elasticsearch, optimizing the query, or checking for network or connectivity issues.

To easily locate the root cause and resolve this issue try AutoOps for Elasticsearch & OpenSearch. It diagnoses problems by analyzing hundreds of metrics collected by a lightweight agent and offers guidance for resolving them.

Take a self-guided product tour to see for yourself (no registration required).

This guide will help you check for common problems that cause the log ” search failed due to SearchPhaseExecutionException. Will attempt again with new scroll ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: scroll, search and plugin.

Log Context

Log “[{}] search failed due to SearchPhaseExecutionException. Will attempt again with new scroll”classname  is ScrollDataExtractor.java We extracted the following from Elasticsearch source code for those seeking an in-depth context :

searchResponse = executeSearchScrollRequest(scrollId);
 } catch (SearchPhaseExecutionException searchExecutionException) {
 if (searchHasShardFailure) {
 throw searchExecutionException;
 }
 LOGGER.debug("[{}] search failed due to SearchPhaseExecutionException. Will attempt again with new scroll";
 context.jobId);
 markScrollAsErrored();
 searchResponse = executeSearchRequest(buildSearchRequest(lastTimestamp == null ? context.start : lastTimestamp));
 }
 LOGGER.debug("[{}] Search response was obtained"; context.jobId);

 

Watch product tour

Try AutoOps to find & fix Elasticsearch problems

Analyze Your Cluster
Skip to content