After allocating node would have less than the required free bytes threshold bytes free preventing allocation – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 2.3-2.3

Briefly, this error occurs when Elasticsearch tries to allocate shards to a node, but the node doesn’t have enough free space. Elasticsearch has a disk watermark setting that prevents shard allocation if it would leave less free space than the threshold. To resolve this, you can either increase the disk space on the node, delete unnecessary data to free up space, or adjust the disk watermark settings to allow more disk usage. However, be cautious with the last option as it could lead to disk space issues in the future.

This guide will help you check for common problems that cause the log ” after allocating; node [{}] would have less than the required {} free bytes threshold ({} bytes free); preventing allocation ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: allocation, cluster, node, routing and threshold.

Log Context

Log “after allocating; node [{}] would have less than the required {} free bytes threshold ({} bytes free); preventing allocation” classname is DiskThresholdDecider.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

         // Secondly; check that allocating the shard to this node doesn't put it above the high watermark
        final long shardSize = getShardSize(shardRouting; allocation.clusterInfo());
        double freeSpaceAfterShard = freeDiskPercentageAfterShardAssigned(usage; shardSize);
        long freeBytesAfterShard = freeBytes - shardSize;
        if (freeBytesAfterShard 

 

 [ratemypost]