Is it possible query for summed up cardinalities?


(Luka Zitnik) #1

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


(Daniel Mitterdorfer) #2

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


(Luka Zitnik) #3

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.


(Daniel Mitterdorfer) #4

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


(system) #5

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