# Elasticsearch how to prevent duplicate data?

**URL:** <https://discuss.elastic.co/t/elasticsearch-how-to-prevent-duplicate-data/164039>\
**Category:** Elasticsearch\
**Created:** [January 13, 2019, 2:14pm UTC](https://discuss.elastic.co/t/elasticsearch-how-to-prevent-duplicate-data/164039 "2019-01-13T14:14:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_5amy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/m_5amy/32/32662_2.png) [@m\_5amy](https://discuss.elastic.co/u/m_5amy)\
**Post date:** [January 13, 2019, 2:14pm UTC](https://discuss.elastic.co/t/elasticsearch-how-to-prevent-duplicate-data/164039/1 "2019-01-13T14:14:18Z")

</div>

Hi all,

I need to prevent documents to be inserted into single index if it has the same data

EX:

```auto
{
    "_score":1.0,
    "_source":{
        "value":{
            "user":"test user",
            "age":"20"
        }
}

I need top prevent any documents has the same user and age into the same index

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 13, 2019, 2:26pm UTC](https://discuss.elastic.co/t/elasticsearch-how-to-prevent-duplicate-data/164039/2 "2019-01-13T14:26:47Z")

</div>

You should compute a fingerprint based on content and use this fingerprint as the document id.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 13, 2019, 2:39pm UTC](https://discuss.elastic.co/t/elasticsearch-how-to-prevent-duplicate-data/164039/3 "2019-01-13T14:39:01Z")

</div>

Have a look at these blog posts:

> **[Efficient Duplicate Prevention for Event-Based Data in Elasticsearch
	  	 |...](https://www.elastic.co/blog/efficient-duplicate-prevention-for-event-based-data-in-elasticsearch)**
>
> Need to prevent duplicates in the Elastic Stack with minimal performance impact? In this blog we look at different options in Elasticsearch and provide some practical guidelines.

> **[Little Logstash Lessons: Handling Duplicates](https://www.elastic.co/blog/logstash-lessons-handling-duplicates)**
>
> Approaches for de-duplicating data in Elasticsearch using Logstash. We also go into examples of how you can use IDs in Elasticsearch Output.

---

<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:** [February 10, 2019, 2:39pm UTC](https://discuss.elastic.co/t/elasticsearch-how-to-prevent-duplicate-data/164039/4 "2019-02-10T14:39:06Z")

</div>

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