Unique metric count status not showing correctly due to duplication of serverid within timerange

Hello All,

I'm doing a use case where in I need to able to diaplay correct "unique count" of "idle" and
"Active" session and server session count(IDLE+ACTIVE=Total Session).Here I'm unable to get unique count of "idle" and "active" session count.Here idle or active may or may not show correct value.

Note: the data displayed is comming through script running every 2 min,and time range by default is 15 min set.
So for 2 min data is correct for "Idle " and "Active",Here challenge is the user is "Idle " or "Active"
in any of serverId i.e---Same user can have Idle or Active status in "N" no of servers.
When checked log and observation is the user data is showing Active or idle for same Server id
,i.e Duplication of data and hence when same serverID is fluctuating between "Idle" or "Active"
state for timerange selected default 15 min in discover,

aggregation: 1)Unique count -server.id 2) Filter based on "Ideal" or "Active"
Issue: Multiple entries for server Id with multiple status between ACTIVE or IDLE and hence
incorrect data in Idle or Active session count.

Any suggestion,Apart from making seperate Index for those 2 visuals at left bottom,there by avoiding duplication/overriding the serverid data.Logstash doc_upsert, doc id ..might resolve?
Any Alternatives?