# Retrieve duplicate data using Kibana search bar

**URL:** <https://discuss.elastic.co/t/retrieve-duplicate-data-using-kibana-search-bar/74229>\
**Category:** Kibana\
**Created:** [February 7, 2017, 1:48pm UTC](https://discuss.elastic.co/t/retrieve-duplicate-data-using-kibana-search-bar/74229 "2017-02-07T13:48:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [February 7, 2017, 1:48pm UTC](https://discuss.elastic.co/t/retrieve-duplicate-data-using-kibana-search-bar/74229/1 "2017-02-07T13:48:54Z")

</div>

I've been working on retrieving duplicate data from Elasticsearch. However the duplicate filter query I have is not working as expected. I tried the query on KIBANA's search tab but its always showing an error message.

I hope that if my query will work on Kibana, the investigation would be easier. Could you help me create the right query for this?

```
POST /costing_requests/_search
{   
    "aggs": {
         "duplicateCount": {
              "terms": {
                  "field": "CostInvoiceNumber",
                  "min_doc_count": 2
              }
         }
     },        
    "query": {
      "filtered": {
         "filter": {
            "bool": {
                 "must": [{
                    "range": {
                       "tslice": {
                           "gte": "2017-01-18",
                           "lte": "2017-01-19"
                        }
                    }
                 }],
                "must_not": []
             }
           }
        }
     }
}
```

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [February 9, 2017, 4:32pm UTC](https://discuss.elastic.co/t/retrieve-duplicate-data-using-kibana-search-bar/74229/2 "2017-02-09T16:32:29Z")

</div>

Hi Marge,

I'm not sure if this is what you're looking for, but if I have the following data, and I used the Advanced JSON Input to set the min\_doc\_count to 100,000 I get these results;

 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/1ba8f767226c3227ffed1d93c6e66824e8796d94.png)

And if I change it to 200,000 I eliminate the results from Feb 8th.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/14825cb321ca29131d7d565ce4a8695660c67b53.png)

Here's the request generated by Kibana;

```auto
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "*",
            "analyze_wildcard": true
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": 1486052951832,
              "lte": 1486657751832,
              "format": "epoch_millis"
            }
          }
        }
      ],
      "must_not": []
    }
  },
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "@timestamp",
        "interval": "1d",
        "time_zone": "America/Chicago",
        "min_doc_count": 200000
      }
    }
  }
}

```

---

<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:** [March 9, 2017, 4:32pm UTC](https://discuss.elastic.co/t/retrieve-duplicate-data-using-kibana-search-bar/74229/3 "2017-03-09T16:32:58Z")

</div>

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