Get documents with certain search criteria and with max priority

Hi,

I have documents which have two lists, allow and deny, each entry in those lists are <id, priority> tuples. For example a document can have the following tuples on it

allow : <10, 1>, <20, 5>, <30, 3>, <40, 6>, <50, 4>
deny: <30, 4>, <70, 2>, <40, 3>

When I search for id 40 it should check both the lists, since it exists in both then I would check their priority. Since allow priority is 6 the search should return the document.

When I search for id 30, since it exists on both then I compare priority and since the deny priority is 4 it should not return the document.

How do I translate the above into an elastic search query?

Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.