# Latest version of documents only in Kibana

**URL:** <https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983>\
**Category:** Kibana\
**Created:** [July 13, 2018, 5:21pm UTC](https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983 "2018-07-13T17:21:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adossi](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@adossi](https://discuss.elastic.co/u/adossi)\
**Post date:** [July 13, 2018, 5:21pm UTC](https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983/1 "2018-07-13T17:21:41Z")

</div>

I have a document with \_id "123456", and when I do a GET in Elasticsearch for that ID in my index I can see that it is \_version: 2 which makes sense because I updated it.

However in my Kibana visualizations it seems like it is picking up both versions of the same document when showing the results.

How do I exclude versioned documents from re-appearing in the visualization? For example, this record is showing up twice in my bar graph.

EDIT: I should mention I've tried both of these additions to the savedSearchJson and neither of them appear to do anything/work

```
"aggs": {
    "latest": {
      "terms": {
        "field": "_id"
      }
    }
  }

```

and

```
"aggs": {
    "latest": {
      "max": {
        "field": "version"
      }
    }
  }
```

---

<div class="post-metadata">

**Author:** ![chrisronline](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrisronline/32/28230_2.png) [@chrisronline](https://discuss.elastic.co/u/chrisronline)\
**Post date:** [July 17, 2018, 1:32pm UTC](https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983/2 "2018-07-17T13:32:23Z")

</div>

Hi @adossi,

This seems unlikely. The `version` field changing should not cause repeat documents to appear.

How are you verifying the same document is reported twice? Can you perform a search query against your indices to check if there are multiple with the same value, which might cause what you are seeing?

---

<div class="post-metadata">

**Author:** ![adossi](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@adossi](https://discuss.elastic.co/u/adossi)\
**Post date:** [July 17, 2018, 4:05pm UTC](https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983/3 "2018-07-17T16:05:56Z")

</div>

They're definitely the same document - I've done a GET and I've done a \_search, only one document is returned with that ID.

My workaround was to change all of my visualizations from doing 'Y Axis - Count' to 'Y Axis - Unique Count on field \_id'

The fact that workaround works should indicate that indeed duplicates with the same \_id are appearing in the dashboard

---

<div class="post-metadata">

**Author:** ![adossi](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@adossi](https://discuss.elastic.co/u/adossi)\
**Post date:** [July 27, 2018, 2:01pm UTC](https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983/4 "2018-07-27T14:01:54Z")

</div>

Bumping this - Chris have you had a chance to read my previous reply?

---

<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:** [August 24, 2018, 2:10pm UTC](https://discuss.elastic.co/t/latest-version-of-documents-only-in-kibana/139983/5 "2018-08-24T14:10:43Z")

</div>

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