# How to remove duplicate values?

**URL:** <https://discuss.elastic.co/t/how-to-remove-duplicate-values/209665>\
**Category:** Logstash\
**Created:** [November 27, 2019, 10:58am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-values/209665 "2019-11-27T10:58:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ja123](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@ja123](https://discuss.elastic.co/u/ja123)\
**Post date:** [November 27, 2019, 10:58am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-values/209665/1 "2019-11-27T10:58:00Z")

</div>

I've got serveral docs with same "index" and many duplicate values in elasticsearch:

> {  
> "\_index" : "bahnlog-29\_11\_2019",  
> "\_type" : "\_doc",  
> "\_id" : "l7YfrG4Baw1619OK5ufn",  
> "\_score" : 1.0,  
> "\_source" : {  
> "@timestamp" : "2019-11-27T09:10:00.816Z",  
> "@version" : "1",  
> "parsed" : {  
> "Journey" : [  
> {  
> "ID" : "2019-11-27T09:59:00.000Z\_8000191",  
> "delay" : 14  
> },  
> {  
> "ID" : "2019-11-27T09:59:00.000Z\_8000231",  
> "delay" : 2  
> }  
> ]  
> {  
> "\_index" : "bahnlog-29\_11\_2019",  
> "\_type" : "\_doc",  
> "\_id" : "mLZErG4Baw1619OKhufy",  
> "\_score" : 1.0,  
> "\_source" : {  
> "parsed" : {  
> "Journey" : [  
> {  
> "ID" : "2019-11-27T09:59:00.000Z\_8000191",  
> "delay" : 14  
> }  
> {  
> "ID" : "2019-11-27T09:59:00.000Z\_2323231",  
> "delay" : 1212  
> }

How can I remove the whole duplicate fields which belogs to the same `ID` or maybe merge the two docs? To always overwrite the doc with a document\_id is not the solution in my opinion, because I want to log the old values as well.

---

<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:** [December 25, 2019, 10:58am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-values/209665/2 "2019-12-25T10:58:02Z")

</div>

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