# Kibana unique count more that number of records

**URL:** https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826
**Category:** Kibana
**Created:** [April 20, 2024, 1:48am UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826 "2024-04-20T01:48:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![erickhillo](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@erickhillo](https://discuss.elastic.co/u/erickhillo)
#### Post date: [April 20, 2024, 1:48am UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826/1 "2024-04-20T01:48:42Z")

</div>

hi everyone

I´m using kibana dashboards, and when I try to add a metric with unique count to select all uniques the number of uniques is not the same that the number of records that I have, for example in my index I've 52727 records but when I do the metric with unique count the result that I´ve is 52903, and I don´t know why, Isn´t problem of data the field that I´m using exist in each record, it doesn´t have spaces or any character that can be part of the problem, in fact is an UUID

hope you can help me

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [April 20, 2024, 3:00am UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826/2 "2024-04-20T03:00:33Z")

</div>

Hi @erickhillo Welcome to the community

Can you show the exact commands and the results you ran that resulted in these results? Otherwise we can't help 🙂

---

<div class="post-metadata">

### Author: ![erickhillo](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@erickhillo](https://discuss.elastic.co/u/erickhillo)
#### Post date: [April 22, 2024, 11:18pm UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826/3 "2024-04-22T23:18:03Z")

</div>

> [@stephenb](#):
>
> Can you show the exact commands and the results you ran that resulted in these results? Otherwise we can't help

```auto
GET example/_search
{
  "size": 0, 
  "_source": false, 
  "query": {
    "match": {
      "comprobante_type":"comprobantes"
    }
  },
  "aggs": {
    "Total_unique": {
      "cardinality": {
        "field": "myfieldhere"
        }
      }
  }
}

```

this is my query and I got this result

```auto
},
  "aggregations": {
    "total_unique": {
      "value": 72903
    }
  }
}

```

but in my discover I've these result with same filters

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/e/aecd6298f408f337b6469258e2040d33f572dc70.png)

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [April 23, 2024, 2:13am UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826/4 "2024-04-23T02:13:40Z")

</div>

What version of Elasticsearch and Kibana is that?

Also one has a time frame and other does not?

What is the query in discover?

Also you should probably use a `term` query if the type is `keyword`

You can also look at inspect to see the query from Kibana...

---

<div class="post-metadata">

### Author: ![erickhillo](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@erickhillo](https://discuss.elastic.co/u/erickhillo)
#### Post date: [May 8, 2024, 1:01am UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826/5 "2024-05-08T01:01:48Z")

</div>

I'm using kibana 8.13.3 same elasticsearch, no it's the total of record time doesn't matter

this is the query

```auto
"query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "range": {
            "cfdi:Comprobante.@Fecha": {
              "format": "strict_date_optional_time",
              "gte": "2019-05-07T23:58:19.815Z",
              "lte": "2024-05-08T00:58:19.815Z"
            }
          }
        },
        {
          "match_phrase": {
            "comprobante_type": "comprobantes"
          }
        }
      ],
      "should": [],
      "must_not": []
    }

```

as you can see I've dates but it's last 5 year and I dont have documents beyond 2 or 3 years

---

<div class="post-metadata">

### Author: ![erickhillo](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@erickhillo](https://discuss.elastic.co/u/erickhillo)
#### Post date: [May 8, 2024, 1:02am UTC](https://discuss.elastic.co/t/kibana-unique-count-more-that-number-of-records/357826/6 "2024-05-08T01:02:57Z")

</div>

sorry for late response a lot of work, hope someone can help me
