I have an issue where my mapping includes an array of nested objects. Let's
imagine something simplified like this:
{
"properties":{
"datetime":{"type":"date"},
"tags":{"type":"object","properties":{
"object_of_type_a":{"type":"nested","properties":{"##SOME FIELDS##"}},
"object_of_type_b":{"type":"nested","properties":{"##SOME FIELDS##"}},
}
}
}
Both object_of_type_a and object_of_type_b are arrays of the actual nested
object.
So, one doc may look like:
{
"datetime":"17-06-2014T14:11",
"##other fields I don't care about right now##",
"tags":{
"object_of_type_a":[{"form":"whatever",...},{"form":"another thing",...}],
"object_of_type_b":[{"form":"something else",...},{"form":"others",...}],
}
}
Now imagine I want to aggregate for each element of some of the fields from
one of the inner objects, but also obtain their histogram based on the
top-level field ("datetime").
"aggs": {
"top_agg": {
"nested": {
"path": "tags.object_of_type_a"
},
"aggs": {
"medium_agg": {
"terms": {
"size": 5,
"field": "tags.object_of_type_a.form"
},
"aggs": {
"reverse": {
"reverse_nested": {},
"aggs": {
"timeline": {
"date_histogram": {
"field": "datetime",
"interval": "day"
}
}
}
}
}
}
}
}
Once I try to do so, I am getting an error:
Parse Failure [Aggregation definition for [object_of_type_a starts with a
[START_ARRAY], expected a [START_OBJECT].]]; }
Is it possible to perform such an aggregation?
Thanks in advance. Really appreciate any help you can provide..
--
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/104ffef4-8bd8-4422-9a19-b3b4a31ff7ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.