Aggregations with object type properties

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.

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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2fb7d54b-9a52-4583-ae62-f95cbf1c5e35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

There are several ways of ding this. Probably the easiest is to add nested
objects to your mapping. Read more here:

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.
Aggregation example · GitHub

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 elasticsearch+unsubscribe@googlegroups.com.
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.

Hi Michael, and thank you for your answer.

I would rather not use nested objects because it will hurt the performance
of my application.
Do you know of any another way ?

--
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/3860607a-69fb-4eee-b673-7bfb1712dbd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.