How to use Java API to build a nested query with filter query combination in 5.6.x?

Currently we are migrating from 1.7 to 5.6 version in our project.
1.7 java
FilterBuilder fb = FilterBuilders.boolFilter()
.must(FilterBuilders.termFilter("isVersion", 0))
.mustNot(FilterBuilders.termFilter("currentLifeCycleState", "deleted"))
.mustNot(FilterBuilders.termFilter("mixinType", "HiddenInNavigation"))
.must(FilterBuilders.inFilter("acl", fullAcl));

QueryBuilder nestedQb = QueryBuilders.nestedQuery("sl:shares",
QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("sl:shares.expirationInMillis").gt(nowInMillis)));

nestedQb = QueryBuilders.filteredQuery(nestedQb, fb);
I have updated the code with 5.6
QueryBuilder boolQuery = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("isVersion", 0))
.mustNot(QueryBuilders.termQuery("currentLifeCycleState", "deleted"))
.mustNot(QueryBuilders.termQuery("mixinType", "HiddenInNavigation"))
.must(QueryBuilders.termsQuery("acl", fullAcl));

QueryBuilder nestedQuery = QueryBuilders.nestedQuery("sl:shares", QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("sl:shares.expirationInMillis").gt(nowInMillis)),ScoreMode.Avg);

nestedQuery = QueryBuilders.boolQuery().filter(boolQuery);

But I am getting different result with 5.6 version. This is correct way migrate 5.6. Please help anything I missing.

Please help how to get the same result with 5.6.x version

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