elastic/elasticsearch · error · IllegalArgumentException

The product of hash_count [{}], bucket_count [{}], and hash_

Error message

The product of hash_count [{}], bucket_count [{}], and hash_set_size [{}] is [{}], which exceeds the maximum token count limit [{}]. This limit can be set by changing the [{}] index level setting.

What it means

Error "The product of hash_count [{}], bucket_count [{}], and hash_set_size [{}] is [{}], which exceeds the maximum token count limit [{}]. This limit can be set by changing the [{}] index level setting." thrown in elastic/elasticsearch.

Source

Thrown at modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/MinHashTokenFilterFactory.java:43

 *
 */
public class MinHashTokenFilterFactory extends AbstractTokenFilterFactory {

    private final MinHashFilterFactory minHashFilterFactory;

    MinHashTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
        super(name);
        int hashCount = settings.getAsInt("hash_count", MinHashFilter.DEFAULT_HASH_COUNT);
        int bucketCount = settings.getAsInt("bucket_count", MinHashFilter.DEFAULT_BUCKET_COUNT);
        int hashSetSize = settings.getAsInt("hash_set_size", MinHashFilter.DEFAULT_HASH_SET_SIZE);
        // Only validate when the user explicitly configured parameters; eager instantiation with
        // default settings (empty Settings) is skipped so that an unrelated low max_token_count
        // on an index that doesn't use min_hash does not cause index creation to fail.
        if (settings.hasValue("hash_count") || settings.hasValue("bucket_count") || settings.hasValue("hash_set_size")) {
            long maxTokenCount = indexSettings.getMaxTokenCount();
            long maxOutputTokens = (long) hashCount * bucketCount * hashSetSize;
            if (maxOutputTokens > maxTokenCount) {
                throw new IllegalArgumentException(
                    "The product of hash_count ["
                        + hashCount
                        + "], bucket_count ["
                        + bucketCount
                        + "], and hash_set_size ["
                        + hashSetSize
                        + "] is ["
                        + maxOutputTokens
                        + "], which exceeds the maximum token count limit ["
                        + maxTokenCount
                        + "]. This limit can be set by changing the ["
                        + IndexSettings.MAX_TOKEN_COUNT_SETTING.getKey()
                        + "] index level setting."
                );
            }
        }
        minHashFilterFactory = new MinHashFilterFactory(convertSettings(settings));
    }

View on GitHub (pinned to db6a809a66)

When it happens

Trigger: Thrown at modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/MinHashTokenFilterFactory.java:43 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/335b30ff6332aa4c. Report an issue: GitHub.