Setting must be non-negative – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.12-8.9

Briefly, this error occurs when a setting in Elasticsearch is assigned a negative value, which is not allowed. The setting could be anything like index refresh interval, shard count, etc. To resolve this issue, you need to ensure that the value assigned to the setting is non-negative. You can do this by checking your configuration files or scripts for any negative values and replacing them with appropriate non-negative values. Also, ensure that any dynamic settings updated via the API are non-negative.

This guide will help you check for common problems that cause the log ” setting [{}] must be non-negative ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “setting [{}] must be non-negative” class name is SharedBlobCacheService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 );  private static Setting.Validator getPageSizeAlignedByteSizeValueValidator(String settingName) {
 return value -> {
 if (value.getBytes() == -1) {
 throw new SettingsException("setting [{}] must be non-negative"; settingName);
 }
 if (value.getBytes() % SharedBytes.PAGE_SIZE != 0L) {
 throw new SettingsException("setting [{}] must be multiple of {}"; settingName; SharedBytes.PAGE_SIZE);
 }
 };

 

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?