What is adjust_pure_negative?

Can someone please explain what does "adjust_pure_negative" do exactly. I couldn't find any documentation regarding on this. I'm using Elasticsearch 6.8.2 version.

It’s simply telling Lucene to do a sane thing rather than the default insane thing it does.

If you only have a “must not” clause, Lucene assumes by default you want to match absolutely nothing, and especially not the thing detailed in the not clause. Kind of pointless.

With the adjust parameter elasticsearch takes the query with the not clause and adds a must “match_all” query so we match everything apart from what’s in the not clause. It’s just more logical that way.

Thanks @Mark_Harwood. But I can't think about an example which needs to adjust parameter to be false.

I believe that’s why we considered removing the flag and hard coding the default of true. It’s probably a fear of breaking existing systems that relied on it that stopped us removing it.

We certainly don’t advertise the parameter or document it in the Bool docs which is why you’re here I suppose :smile:

I opened this issue to see if we can tidy things up here

Thanks @Mark_Harwood

Can I ask where you saw this flag appear?
I've been scanning Kibana code and can't see where it adds it to requests.

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