Is it possible query for summed up cardinalities?

I use Cardinality Aggregation in a query. Is it possible modify the query such that the response also contains the sum of those counts?

Hi @luka,

the cardinality aggregation is a single-value aggregation, i.e. it produces only a single value. What do you want to sum up? Can you show a concrete example?

Nevertheless, if you want to sum the results of an aggregation, you can use the sum bucket pipeline aggregation.

Daniel

1 Like

Hi @danielmitterdorfer,

The aggregation was only the last one in a series of nested aggregations, so your guessed my case correctly. Thank you!

ps I am still at version 1.7 and didn't know about pipelines.

Hi Luka,

Oh, I assumed you were at least on 2.x. Note that pipeline aggregations have been added in Elasticsearch 2.0, so unfortunately, you cannot use them.

Daniel

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.