TomonoriSoejima/Tejun

duplicate check

Opened this issue · 0 comments

  • request
POST your_index_name/_bulk
{ "index": { "_id": "document_id_1" } }
{ "hash": { "md5": "your_same_value_here" }, "other_field": "other_value_1" }
{ "index": { "_id": "document_id_2" } }
{ "hash": { "md5": "your_same_value_here" }, "other_field": "other_value_2" }
{ "index": { "_id": "document_id_3" } }
{ "hash": { "md5": "your_same_value_here" }, "other_field": "other_value_3" }


GET your_index_name/_search?size=0
{
  "aggs": {
    "md5": {
      "terms": {
        "field": "hash.md5.keyword"
      }
    }
  }
}
  • response
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 3,
      "relation": "eq"
    },
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "md5": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "your_same_value_here",
          "doc_count": 3
        }
      ]
    }
  }
}