Very slow performance of must_not with exists in filter

Hi,

We are investigating some slow queries in our Prod environment. We saw that the following filter is much slower than other term queries in query / filter section.

"query": {
"bool": {
"must": {…},
"filter" : {
"should": [
{
"bool": {
"must_not": [
{
"exists": {
"field": "isDiscussionOnly"
}
}
]
}
},
{
"terms": {
"isDiscussionOnly": [
"false"
]
}
}
]
}
}
}

Is there any known performance issue / performance guideline around using must_not with exists.

Would it help to always have this field set (with some default value) and replace the above filter with term query filter?

If you format/indent your code, it makes it easier for people to answer.

Perhaps the discussion in this Github issue would be helpful?

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