You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first count() call does a normal count request, which does not respect post filters. The second .count() call uses the cached response's total hits property, which does respect post filters.
I see that this is somewhat intentional based on the comments from #518 . But, In my opinion, this behavior is a bug because the value of a method call changes depending on hidden internal state, which doesn't align with this libraries immutable API design.
I'm not sure what the ideal behavior would be - maybe never used the cached result for .count() if the search has a post filter?
Reproduction:
The first
count()call does a normal count request, which does not respect post filters. The second.count()call uses the cached response's total hits property, which does respect post filters.I see that this is somewhat intentional based on the comments from #518 . But, In my opinion, this behavior is a bug because the value of a method call changes depending on hidden internal state, which doesn't align with this libraries immutable API design.
I'm not sure what the ideal behavior would be - maybe never used the cached result for .count() if the search has a post filter?