We have this mapping:
{
"product_achievement": {
"type": "nested",
"properties": {
"id": {
"type": "long"
},
"last_purchase": {
"type": "long"
},
"products": {
"type": "long"
}
}
}
}
As you see this is nested, and the last_purchase
field is a unixtimestamp
value. We would like to query from all nested elements the most recent entry defined by the last_purchase
field, AND see if in the last entry there is some product id is in products.