The bool query can do both NOT (must_not clause), OR (should clause) and AND (must clause). For NEAR you can use span_near or match_phrase queries that you can then wrap into a bool query.
The bool query should be your main query as it allows you to add a clause (containing a term, range, wildcard, match_phrase and many other subqueries). The bool query is the glue that allows combining many queries.
Thanks,
I have problem with the proposed solution.
To translate the query (A OR B) NEAR (C OR D) - Span* can do the job, and I can not use bool for NEAR. However, to implement (NOT A) the best solution is to use bool. The main problem is that span_* does not accept bool queries.
Is there a way to implement (NOT term) with span_*?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.