Skip to content

Elasticsearch plugins can no longer define sibiling pipeline aggregator #42493

@tools4origins

Description

@tools4origins

Elasticsearch version : v7.0.1, v7.1.0
Plugins installed: []
JVM version (java -version): Any
OS version (uname -a if on a Unix-like system): Any

Description of the problem including expected versus actual behavior:
Since the PR #34658 it no longer is possible to define a custom sibling pipeline aggregation as all SiblingPipelineAggregator constructors are package-private.

A plugin we developed add such metrics in ES 5 and ES 6, unfortunately because of this change we cannot adapt the code for ES 7.

My guess is that the constructor accessibility change was done without having plugin development in mind (tagging you @polyfractal as, as the author of the PR, you may be able to confirm that?).

Could it be set back to public?

Similar limitations are caused by package-private constructors and final methods in the org.elasticsearch.search.aggregations module. Those one can be bypassed by duplicating code instead of inheriting.

The issue with SiblingPipelineAggregator is that there is a check in aggregation phase that specifically check pipelineAggregator instanceof SiblingPipelineAggregator so we must inherit SiblingPipelineAggregator to define a sibling pipeline aggregator. But we no longer can :(.

We would highly appreciate a accessibility change for SiblingPipelineAggregator constructors, I assume for other constructors and final method the design has more reasons to exist and it doesn't restrict us even though it make our code a bit uglier.

Steps to reproduce:

With this class defined:

package com.organization.customplugin.elasticsearch.search.aggregations.pipeline;

import org.elasticsearch.search.aggregations.pipeline.SiblingPipelineAggregator;

import java.util.Map;


public abstract class PublicSiblingPipelineAggregator extends SiblingPipelineAggregator {
    PublicSiblingPipelineAggregator(String name, String[] bucketsPaths, Map<String, Object> metaData) {
        super(name, bucketsPaths, metaData);
    }
}

This compilation error is raised:
error: PublicSiblingPipelineAggregator(String,String[],Map<String,Object>) is not public in PublicSiblingPipelineAggregator; cannot be accessed from outside package

Dependencies:

    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>7.1.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions