Count Metric Usage

I am trying to create a table panel in Grafana. I have an ES index collecting data from DB using Logstash. My actual DB table consist of only 12 rows with status either as COMPLETED or PENDING.

I want to have a table which shows me the number of rows which are completed and number of rows which are pending.
I am doing that as:

Metric: Count
Group By : Terms status.keyword

But on doing this I am getting COMPLETED count as 630 and PENDING count as 7, which sum as the total number of hits in ES.

I am expecting results to be COMPLETED count 8 and PENDING count 4. Sum should never exceed 12 , as there are only 12 rows in my data.

Can you please help where I am going wrong.

maybe you have more documents in ES then you think? ES seems to return 630.

You can check the raw query and raw ES response by using the query inspector (introduced in Grafana v4.6 in metrics tab).

I have scheduled the logstash config file to run every minute. So it is pushing data every minute into ES. The count I was getting is the sum total of all.

To solve it, the only solution I can see is Override the time to 1m in Time Range of the panel. So that I see the count of last collected data only and not the sum total.