Skip to content

Multi level nested sorting incorrectly using bitset filter cache #31783

@martijnvg

Description

@martijnvg

While looking into #31554, I noticed that in case multi level nested sorting is used and levels use a nested filter then the nested field type filter AND specified nested filter by the user are cached in the bitset filter cache.

In the case of #31554 this ended up being cached: +_type:__nested1 #ToParentBlockJoinQuery (nested1.nested1_keyword:nested1_foo). I would only expect +_type:__nested1 to be cached by the bitset filter cache.

I think this is not intended and if many different nested sort filter where to be specified in separate search requests then this could cause the bitset filter cache to consume a lot of jvm heap space.

The problem is in SortBuilder class line 251 where this happens: context.bitsetFilter(parentQuery)
and in the case of multi level sorting parentQuery could be set to the nested filter of the parent nested sort definition.

I'm not sure how this can be best be fixed. I'm opening this issue to track the problem.

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions