How not to query on specific fields in elasticsearch

My usecase demands to search on all fields for a given keyword except 2 fields. must_not is not working, Pls guide.


to set up parmeter 'include_in_all ' in mappings on the 2 fields, and use query_string or simple_query_string query.

Thanks Wenpos for the reply. But I will need these 2 fields in other queries, so I cannot do an "include_in_all" to false, since it may bother my other queries. Pls let me know if there is a way out.


The two fields can also be assigned in query DSL, no matter set it “include_in_all” or not. If you need not use _all, you 'd better have specific fields.

Why the must_not is not working ?

If you have a bool query with one must on all fields and one must_not on both fields, it should be ok ?

I am not sure... may be loosing something while mapping

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