, "status_one": , "status_two": } Now, I want to first gro" /> , "status_one": , "status_two": } Now, I want to first gro" /> , "status_one": , "status_two": } Now, I want to first gro"/>

OpenSearch: How to perform a term aggregation on top of a bucket aggregation?

13 views Asked by At

I have the following structure of data in the index:

{
  "identifier": <uuid>,
  "status_one": <string>,
  "status_two": <string>
}

Now, I want to first group the data by the identifier, and on top of that merge the status_one and status_two into a single field. I am able to do that using scripted_metric aggregation.

Finally, I want to perform term aggregation on top of these buckets. i.e, if I directly did term aggregation on status_one field, it will give us count of records for each of possible statuses. I need to do similar for the merged records.

I have tried stats_bucket and other types of aggregation, but they are not giving the correct results.

0

There are 0 answers