I am trying to write an aggregation query but not sure what I am missing here. I have the following structure across multiple documents. Some of the field names may not be present in documents.
I am able to aggregate on different field names, but I want to also aggregate values for each field bucket. So I want to create a bucket for A and see list of values under A.
How have you mapped your data? You will need to map CaptureData as a nested field in order to do this.
Once you have done that, you will be able to execute a nested aggregation on CaptureData. Inside that nested aggregation, you can use a terms aggregation to get a set of buckets for FieldName and inside of that a terms aggregation on FieldValue to get a list of values under each A, B, etc.
Alright, you did not map CaptureData as type nested. When creating the index apply the following mapping instead (the only difference is for CaptureData):
Thanks a lot. this works. However it seems this doesn't work from Kibana when I am doing Sub Series Aggregation. Any idea what I might have to change as I want to make it work from Kibana as well.
Yeah, Kibana has very limited support for nested aggregations. You may want to take a look at Vega visualizations. Those allow you to visualize whatever Elasticsearch returns, including the response of a nested aggregation. There is however a bit of a learning curve to working with Vega.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.