- I have an application which wants to expose the API to query Arbitary AND OR NOT queries to the user. The user should be able to give me a string which any number of AND, OR and NOT phrases. The rules for nesting should be parenthesis and normal precedence rules should apply.
As an Eg.
- query= ( (Abhishek AND Vaid) OR ( Abhishek AND Vaids) ) AND NOT (Abhishek AND Vaider) should be a valid query.
The Rules for operators are as following:
- I'm defining three operators here:" AND "," OR ",and" NOT ". (these are AND, OR and NOT.
- The " NOT " is unary and " AND " and " OR " is binary. " NOT " has higher precedence over other two.
Is there a way for me to do this out of the box from Java Driver in ES ? Please note that I can always convert such a query in nested boolean, but I don't want to write a lexer and parser to create a parse tree by scratch and then resolve it to a complex boolean DSL. I'm looking for some existing functionality to achieve this.