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.