Failed to apply started shards %s – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 8.3-8.9

Briefly, this error occurs when Elasticsearch is unable to allocate shards to nodes in the cluster. This could be due to insufficient resources, network issues, or configuration errors. To resolve this, you can try increasing the system resources, checking the network connectivity between nodes, or reviewing the shard allocation settings in your Elasticsearch configuration. Additionally, ensure that the cluster health status is green and that there are no unassigned shards. If the problem persists, consider reindexing your data or increasing the number of nodes in your cluster.

This guide will help you check for common problems that cause the log ” failed to apply started shards %s ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: shards, cluster, shard.

Log Context

Log “failed to apply started shards %s” classname is ShardStateAction.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                for (final var taskContext : tasksToBeApplied) {
                    taskContext.success(() -> taskContext.getTask().listener().onResponse(TransportResponse.Empty.INSTANCE));
                }
            } catch (Exception e) {
                logger.warn(() -> format("failed to apply started shards %s"; shardRoutingsToBeApplied); e);
                for (final var taskContext : tasksToBeApplied) {
                    taskContext.onFailure(e);
                }
            }

 

 [ratemypost]