How to display unique count with latest value in Kibana

Hello All, Heeelp please

whenever logistic partner update the order status then new status is pushed into elasticseach.

Now every order is having multiple enteries with order status like "ORDER CONFIRM" , "APPOINTMENT SCHEDULED" , "OUT FOR DELIVERY" etc..

Problem arise when i need to see how many order are in which status. Total Order Count is 2, but in order status i get total count 4. because it count older values too. as you can see in attached screenshot.

I'm using TopHit to show the latest and actual status for each id ,and it works perfectly , but when i use a filter , the table show all status (old and latest).

Hi, I'm not sure I fully understand what the problem is here. Could you provide some more insight into your dataset? How many orders do you have and how many do you expect to see? What do you mean "it count older values too"? And what filter are you using, on what field?

thanks for your response,
here is schema that explain my essue:

In the visualization, can you click Inspect > View Data > Response? Can you verify the data returned from ES is the one you expect to see?