Finding Duplicates from an index with nested field

Hi I am fairly new to ES and need some help.
I have an index

{
  "shop_index": {
    "properties": {
      "shop_key": {
        "type": "nested",
        "properties": {
          "shop_id": "keyword",
          "shop_number": "long"
        }
      }
    }
  }
}

Now in some cases we are storing some shops with the same shop_key so same shop_id and shop_number, i just need to find these records on ES, i tried with nested aggregation but doesnt give the result also i tried with script "doc['shop_key.shop_id'].value + String.valueOf(doc['shop_number'].value)" but this doesnt return the correct doc_count for duplicate records.
Can you suggest something.
Sorry if the code is bad , i just started with ES 3 days back :slight_smile: so still lot to learn.

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