Having different members with nested mailOpens Array of Objects.
Have to solve this query:
The list of users who have >3 distinct mailOpens.mailingId records
{
"_index": "members",
"_type": "doc",
"_id": "1234567",
"_score": 2,
"_source": {
"mailOpens": [
{
"created": "04/26/2017",
"mailingId": 1
},
{
"created": "04/26/2017",
"mailingId": 1
},
{
"created": "07/14/2017",
"mailingId": 2
},
{
"created": "07/14/2017",
"mailingId": 2
},
{
"created": "07/14/2017",
"mailingId": 3
},
{
"created": "07/14/2017",
"mailingId": 3
}
,
{
"created": "07/14/2017",
"mailingId": 4
}
,
{
"created": "07/14/2017",
"mailingId": 4
}
]
}
}
Output should be like this for all members:
{
"_index": "members",
"_type": "doc",
"_id": "1234567",
"_score": 2,
"_source": {
"mailOpens": [
{
"created": "04/26/2017",
"mailingId": 1
},
{
"created": "07/14/2017",
"mailingId": 2
},
{
"created": "07/14/2017",
"mailingId": 3
}
,
{
"created": "07/14/2017",
"mailingId": 4
}
]
}
}