Hi,
Suppose I have an order
index with the following mapping:
{
"leadTime": 2,
"shipments": [{
"packageId": 1,
"shipped": "2019-06-10",
"received": null
}, {
"packageId": 2,
"shipped": "2019-06-08",
"received": null
}]
}
Now I want to answer the question:
Which packages are shipped before now - leadTime days but not yet received as of now?
The leadTime
varies for different orders.
Now I find myself stuck between two dead ends:
-
If I try to use a script filter on the nested
shipments
document, the script won't have access theleadTime
field on the top document. -
If I try to put the script filter on the outer query, the script can not access the nested shipments document since
doc['shipments']
is missing.
Is there any way for a script in the filter context to access both the top document fields AND the fields from the nested document?
Thanks for any advice.