Skip to content

composite aggregation as child aggregation #28611

Closed
@flefebure

Description

@flefebure

The 6.x new composite aggregation provides a way to scroll and page on terms bucket, and it's a good thing.
However, it's not (for now?) possible to set a composite aggregation as a child of another bucket aggregation.
So it's impossible, for example, to composite-aggregate on a nested or a child entity. This request is not allowed :

{
        "metadatas" : {
            "nested" : {
                "path" : "metaDatas"
            },
            "aggs" : {
                "msisdn" : {
                  "filter" : { "term": { "metaDatas.name": "msisdn" } },
                  "aggs": {
                    "msisdns": {
                       "composite" : {
                          "size":5,
                          "sources" : [{ "value": { "terms" : { "field": "metaDatas.value.raw" } } }]
                       }
                    }
                  }
                }
            }
        }
    }

I don't understand this limitation.
Furthermore, an ES 6.2 patched without the check seems to work as expected.

@Override
   protected AggregatorFactory<?> doBuild(SearchContext context, AggregatorFactory<?> parent,
                                          AggregatorFactories.Builder subfactoriesBuilder) throws IOException {
       /*if (parent != null) {
           throw new IllegalArgumentException("[composite] aggregation cannot be used with a parent aggregation");
       }*/

any insight ?

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