elastic/elasticsearch · error · IllegalArgumentException

[gap_policy] must not be null: [{name}]

Error message

[gap_policy] must not be null: [{name}]

What it means

Error "[gap_policy] must not be null: [{name}]" thrown in elastic/elasticsearch.

Source

Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSortPipelineAggregationBuilder.java:128

    public BucketSortPipelineAggregationBuilder from(int from) {
        if (from < 0) {
            throw new IllegalArgumentException("[" + FROM.getPreferredName() + "] must be a non-negative integer: [" + from + "]");
        }
        this.from = from;
        return this;
    }

    public BucketSortPipelineAggregationBuilder size(Integer size) {
        if (size != null && size <= 0) {
            throw new IllegalArgumentException("[" + SIZE.getPreferredName() + "] must be a positive integer: [" + size + "]");
        }
        this.size = size;
        return this;
    }

    public BucketSortPipelineAggregationBuilder gapPolicy(GapPolicy gapPolicy) {
        if (gapPolicy == null) {
            throw new IllegalArgumentException("[" + GAP_POLICY.getPreferredName() + "] must not be null: [" + name + "]");
        }
        this.gapPolicy = gapPolicy;
        return this;
    }

    @Override
    protected PipelineAggregator createInternal(Map<String, Object> metadata) {
        return new BucketSortPipelineAggregator(name, sorts, from, size, gapPolicy, metadata);
    }

    @Override
    protected void validate(ValidationContext context) {
        context.validateHasParent(NAME, name);
        if (sorts.isEmpty() && size == null && from == 0) {
            context.addValidationError(
                "["
                    + name
                    + "] is configured to perform nothing. Please set either of "

View on GitHub (pinned to db6a809a66)

When it happens

Trigger: Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/pipeline/BucketSortPipelineAggregationBuilder.java:128 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/97ca4fb1573d2604. Report an issue: GitHub.