How to filter a results set AFTER 'collapse'?

Hello! I am really new in elasticsearch.
Please, help me with the search requested build:

I push into an 'event' index records on every document status changes, and then, I want to find documents by CURRENT status (current - means, last reported)

I have the following fields in my 'my_events' index: "obj_id", "name", "type", "status", "status_date"

I can obtain all my documents with 'current' status using 'collapse' approach:
GET /my_events/_search
{
"collapse" : {
"field" : "obj_id"
},
"sort" : [{"status_date" : {"order" : "desc"}}],
"from": 0
}
this request will return by 1 record for every obj_id with 'current' status.

but I need to FILTER this dataset to get, for example, all documents which current status equals, for example, to 'READY_TO_REVIEW'

Is it possible with Elasticsearch?

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.