Remove Multiple entries in visualization

Hello , 
I am trying to remove duplicate values in kibana viz 

Example : i have two keys and values 

Key: id 
value: value1

key:status
value: value1

key:id
value:value1

key:status
value:value2

if you look above 

For single key , i am having multiple values and i need to get latest value for the key ..

Example: id:test-1234
                 status: open 

          again 
       id: test-1234
       status: Closed 

I need to get the latest status value . In metrics viz , as there are multiple entries of ID , i am filtering the ID's based on unique count of it but as you can see there are multiple status for the same ID in a day so i need to get last updated status . Is this can be done through advanced json or any other option . Thanks 

Hello @jerin

This looks like a good strategy for you to try - https://stackoverflow.com/questions/29016271/how-to-get-latest-values-for-each-group-with-an-elasticsearch-query

Hello Matt
if i use the above strategy , i only get top hits of ID..instead i should get count of total ids with unique value. Lets say i am getting the unique value but at the end, for unique value ids have three stats like open, in progress and resolved .. I have to get unique count of tickets with last updated status .

This is what i need
unique count of id and top hit of status

I'm confused about how this doesn't meet your needs. Do you have example documents and an example query you could share?