'ElasticSearch: Want to rollup aggregation to parent level
I have a following records
++++++++++++++++++++++
rid cid result timestamp
1 2 true t1
1 2 false t2
1 3 false t3
1 3 true t4
1 4 false t5
++++++++++++++++++++++
I need to do aggregation in such a way that:
- for rid 1 and cid unique combination get the latest record with recent timestamp for example i should get:
++++++++++get reslts w.r.t. timestamp for cid and rid combination+++++++++++++
rid cid result timestamp
1 2 false t2
1 3 true t4
1 4 false t5
+++++++++++++++++++++++++
- once you have the recent recotds in step 1 aggregate the results at rid level and get the pass and fail count for each rid
++++++final output++++++++
rid: 1
result_false: 2
result_true: 1
+++++++++++++++++
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
