Retrieving the duplicate records with count more than 2 - JAVA API

I have data something like below in ES. I want to retrieve the duplicate records of all customer names whose count is equal or more than 2 using Java API. I'm using 2.x version.

[
{
"customer": "anna",
"state": "TX"
},
{
"customer": "peter",
"state": "NY"
},
{
"customer": "anna",
"state": "WY"
},
{
"customer": "peter",
"state": "WY"
},
{
"customer": "Mike",
"state": "CO"
}
]

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