Say I have a nested array of values in a document. Is there a way to specify that all the elements in the array of values must be in a provided list of values?
For example I have two documents:
{
...
"key" : [ {
"innerKey" : "something"
} , {
"innerKey" : "another"
} , {
"innerKey" : "whatsit"
}
]
...
}, {
...
"key" : [ {
"innerKey" : "something"
} , {
"innerKey" : "different"
}]
...
}
I want to create a query where I give a list of values and returned are the documents where all the "innerKey" values exist in the provided list.
Back to the documents above, I want to pass in a list of values such as [ "something", "anything", "different", "anyOtherValue"] and return only the 2nd document since all of its element exists in this list.
Is there a way to do this in a DSL query? Note that I actually want to do this in Java using combination of Jest and ES Java API so I could perform this logic after I get the results back, but I would like to have ES handle it if possible.