Let say we have following entity
Query constructed in following way
for given data set:
returns different results (0 documents) if
and different result (1 document) if
If you use HSEARCH-3534_lucene.patch against https://github.com/hibernate/hibernate-test-case-templates/tree/master/search/hibernate-search-lucene, noneOfShouldMatchedWithinBooleanQueryInsideFilter_differentResults_directoryBasedVSElasticsearch test will pass, but
when you use HSEARCH-3534_elasticsearch.patch against https://github.com/hibernate/hibernate-test-case-templates/tree/master/search/hibernate-search-elasticsearch/hibernate-search-elasticsearch-5
the same test will fail.
Maybe using should and must in filters like siblings does not make much sense, because should (in directory-based) clause will be ignored, because document must fulfill must criterias and therefor should is ignored, and makes more sense in queries while scoring the search, however I ran into the issue while migrating huge project where such cases appear time to time, due to dynamic queries creation.