Hello, everyone.
Currently using ES v1.7, I encounter the following behaviour :
Consider the following document structure, where products is a nested field
id : "string",
products : [
"price" : long,
"quantity" : long
]
I need to write a request that will bring back all documents where the value of my stock is supérior to a thresold, say 5000.
Thus, I write the following filter (using filter cause I don't care about scoring)
"nested" : {
"filter" : {
"script" : {
"script" : "doc['products.price'].values.sum() * doc['products.quantity'].values.sum()>5000"
}
},
"path" : "products"
}
But it does not work.
I really need the filter to be nested to avoid cross-matches .. Is there a proper way to proceed?
Thanks.