Get the documents with max of @version based on document_id

Hi All,

I have certain documents in my index with each document having a document_id as primary key with the combination of "Campaign" and "Camp Line" which will be %{Campaign}%{Camp Line}

Every Document has @version. I want to filter all the document whose @version is max based on the primary key/document_id

Example, my index has this document

Campaign Camp Line Clicks "@Version"
Campaign 1 1 30 2
Campaign 1 2 45 1
Campaign 1 3 210 2
Campaign 2 1 22 2
Campaign 2 2 130 1
Campaign3 1 34 3
Campaign3 2 23 1
Campaign3 3 28 3

My expected Result is this

Campaign Camp Line Clicks "@Version"
Campaign 1 1 30 2
Campaign 1 3 210 2
Campaign 2 1 22 2
Campaign3 1 34 3
Campaign3 3 28 3

Please let me know , how i can i retrieve this through REST API

Thanks

Bump up

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