There are several ways of ding this. Probably the easiest is to add nested objects to your mapping. Read more here: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html
On Wednesday, July 16, 2014 9:50:54 AM UTC-4, Amine Benhalloum wrote: > > Hi everyone, > > I am trying to figure something out : > > Here's an example of a document that contains object properties, and then > trying to do simple terms aggregations. > https://gist.github.com/BAmine/80e1be219d2ac272561a > > The response I get : > { > "took": 2, > "timed_out": false, > "_shards": { > "total": 5, > "successful": 5, > "failed": 0 > }, > "hits": { > "total": 1, > "max_score": 0, > "hits": [] > }, > "aggregations": { > "test": { > "buckets": [ > { > "key": "canine", > "doc_count": 1, > "test2": { > "buckets": [ > { > "key": "cat", > "doc_count": 1 > }, > { > "key": "dog", > "doc_count": 1 > }, > { > "key": "tiger", > "doc_count": 1 > }, > { > "key": "wolf", > "doc_count": 1 > } > ] > } > }, > { > "key": "feline", > "doc_count": 1, > "test2": { > "buckets": [ > { > "key": "cat", > "doc_count": 1 > }, > { > "key": "dog", > "doc_count": 1 > }, > { > "key": "tiger", > "doc_count": 1 > }, > { > "key": "wolf", > "doc_count": 1 > } > ] > } > } > ] > } > } > } > > The question is : How can I avoid getting, in my sub-aggregations, buckets > whose keys do not belong to the parent aggregation's keys ( example : cat > and tiger are not in the property whose label is feline ) ? > Is there a way to do this without using nested properties ? > > Thank you ! > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f0529c6e-81cf-4a96-a95b-8b7274ea1f06%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
