If I understand correctly, your query should be giving you the right data but it is not formatted as you'd like it?
We don't have the equivalent of XSL to translate our JSON response with "buckets" arrays etc into the collapsed format you require - you'd have to do this in your application code.
Thank you for the response. No, the problem is that I cannot filter top hits aggregation results. I want to group documents by name and then filter them by status on latest document. For example, how to get documents where latest status is "ERROR"?
If we run query from previous post, we'll get 2 results. One with status "ERROR" and another with status "OK". I want to get only records with status "ERROR".
Documents can go through a lot of stages, and status may change a lot of times, but we should always query only by the last one.
@Mark_Harwood, thanks for assisting your advice has helped me much as well, but is there any way to get rid of the terms buckets payload somehow and thus reduce its size since I only need to know this array's length?
I think we're pushing into the limits of what is easily expressed in our DSL and easily computed on-the-fly using raw event data. These questions and more would be so much easier to process using an entity-centric index [1] alongside your event store where the entity in question was a device.
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.