# Display data with the latest date

**URL:** <https://discuss.elastic.co/t/display-data-with-the-latest-date/266196>\
**Category:** Kibana\
**Created:** [March 4, 2021, 8:45am UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196 "2021-03-04T08:45:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)\
**Post date:** [March 4, 2021, 8:45am UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/1 "2021-03-04T08:45:36Z")

</div>

Hi,

I'm new to Kibana and I'm trying out some things.  
Now, I have some dummy data set and I want to filter for some data by a query. How can I get a count for the latest date where data exists?

I'm using a metric visualization, I've picked "Count" as aggregation and a filter in a split group bucket with the following query:

```auto
id: *Kunfu* and not links.id : *

```

is there something like:

```auto
id: *Kunfu* and not links.id : * and date : max() ?

```

I'm using Kibana 7.8

Help is very much appreciated.

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [March 4, 2021, 10:38pm UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/2 "2021-03-04T22:38:46Z")

</div>

Hi,  
Try using [top\_hits](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html).  
Cheers!

---

<div class="post-metadata">

**Author:** ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)\
**Post date:** [March 5, 2021, 7:37am UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/3 "2021-03-05T07:37:51Z")

</div>

Hi AClerk,

I was trying to, but then it displays only one ID and not the aggregated count from that day.  
Is there a way to get the count from the latest day? And if so how?

Help is very much appreciated.

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [March 7, 2021, 11:05pm UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/4 "2021-03-07T23:05:23Z")

</div>

Please provide sample data and the required outcome.  
It will help me, and others, to assist you.  
Cheers!

---

<div class="post-metadata">

**Author:** ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)\
**Post date:** [March 8, 2021, 7:56am UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/5 "2021-03-08T07:56:40Z")

</div>

HI AClerk,

thank you and of course.

Data looks like this:

```auto
{
  "_index": "debug_sample_data",
  "_type": "_doc",
  "_id": "w0K42XcBYzpkMbM6kDBv",
  "_version": 1,
  "_score": null,
  "_source": {
    "datum": "2021-01-11",
    "id": "dummy_Kunfu_C_0",
    "links": [
      {
        "id": "Kunfu_C_Link_0"
      }],
    "tests": [
      {
        "id": "Kunfu_C_Test_0"
      }]
},
  "fields": {
    "datum": [
      "2021-01-11T00:00:00.000Z"
    ]
  },
  "highlight": {
    "id": [
      "@kibana-highlighted-field@dummy_Kunfu_C_0@/kibana-highlighted-field@"
    ]
  },
  "sort": [
    1610323200000
  ]
}

```

The outcome is this:

 ![metric_lastdate](https://us1.discourse-cdn.com/elastic/original/3X/6/5/653358ffb67333cc8306747b4297a9022f637fbd.png)

And looking at the data I see that there are two date fields called "datum". Might this have something to do with my problem?

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [March 8, 2021, 9:54pm UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/6 "2021-03-08T21:54:04Z")

</div>

Sorry, but I did not understand.  
How does your index look like?  
Provide field:value sample of 3-4 docs.  
Then provide the required doc you want to fetch.  
Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 5, 2021, 9:54pm UTC](https://discuss.elastic.co/t/display-data-with-the-latest-date/266196/7 "2021-04-05T21:54:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
