Max shingle size must be at least – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.1-7.15

Briefly, this error occurs when the value set for the ‘max_shingle_size’ parameter in Elasticsearch is less than 2. The ‘max_shingle_size’ parameter is used to control the maximum shingle size for a shingle token filter. To resolve this issue, you can either increase the ‘max_shingle_size’ value to 2 or more, or remove the ‘max_shingle_size’ parameter if it’s not necessary for your use case. Always ensure to validate your settings before applying them to avoid such errors.

This guide will help you check for common problems that cause the log ” [max_shingle_size] must be at least [ ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “[max_shingle_size] must be at least [” class name is SearchAsYouTypeFieldMapper.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 private final Parameter maxShingleSize = Parameter.intParam("max_shingle_size"; false;
 m -> builder(m).maxShingleSize.get(); Defaults.MAX_SHINGLE_SIZE)
 .setValidator(v -> {
 if (v < MAX_SHINGLE_SIZE_LOWER_BOUND || v > MAX_SHINGLE_SIZE_UPPER_BOUND) {
 throw new MapperParsingException("[max_shingle_size] must be at least [" + MAX_SHINGLE_SIZE_LOWER_BOUND
 + "] and at most " + "[" + MAX_SHINGLE_SIZE_UPPER_BOUND + "]; got [" + v + "]");
 }
 })
 .alwaysSerialize();

 

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?