Using parent aggregation key in subaggregation


(Rabin Acharya) #1

I want to know if I can access parent key in subaggregation, as

{

"size": 0, 
"aggs":{
    "*agg1*":{
        "terms":{
            "field":"memberId"
        },
        "aggs":{
            "11":{
                "terms":{
                    "field":"*agg1*._value"
                       
                }
            }
        }
    }
}

}

The above script dont seems to be working, I want to know if any script
exists..

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fb7eb444-55d7-4a1c-bbef-4834609c03a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Adrien Grand) #2

Unfortunately, it is not possible. Aggregations can only aggregate values
that are contained in your documents. The reason is that aggregations are
computed on the fly, so the results of agg1 are still partial while
results of 11 are being built. The only exception to this rule is
sorting: you can sort the buckets of an aggregation according to the value
of a sub-aggregation[1]. It is possible because the sorting phase happens
after all buckets have bee computed.

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_order

On Wed, Apr 23, 2014 at 7:00 PM, Rabin Acharya rbnacharya@gmail.com wrote:

I want to know if I can access parent key in subaggregation, as

{

"size": 0,
"aggs":{
    "*agg1*":{
        "terms":{
            "field":"memberId"
        },
        "aggs":{
            "11":{
                "terms":{
                    "field":"*agg1*._value"

                }
            }
        }
    }
}

}

The above script dont seems to be working, I want to know if any script
exists..

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/fb7eb444-55d7-4a1c-bbef-4834609c03a1%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/fb7eb444-55d7-4a1c-bbef-4834609c03a1%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7_7DxdhagKdxZh%3DBLXQv4C%2BY3ZQS2aQLp0ROK-7fxWAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3