Do subaggregations perform AND operation?

Hi,
If I have a a document with child parts to it like this:

{
"type":"document",
"properties": [
{
"this":"THIS",
"that":"THAT"
}
],
"metadata": {
"count":"1",
"sum":"2"
}

If I build and aggregation with properties.this and then a sub aggregation with properties.that, will the aggregate documents combine the values of "this" and "that" within the same element (AND opreation), or in different elements across the document (OR operation)?

Same with sub element metadata. if I aggregate and do a sub bucket on both fields, I want them to be ANDed in my visualization.

thanks

hi @initproto,

not sure if I follow a 100% given the example document you gave, and what element exactly refers to, so let me know if my answer is beside the question.

Metrics calculated for a sub-aggregation will apply to the inner product of the aggregation-hierarchy.

So if you compute metrics for a terms aggregation on .this with a sub-aggregation for a terms-aggregation on .that, it will compute the metrics for all combinations of the .this and .that values that are present in the documents of your index. That said, it's not really ALL aggregations, because you cap your query to ES with the size-parameter. The order in which the aggregations are defined, defines the priority in which they are evaluated.

thx,

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