NativeSearchQuery exact match sort problems

Hello everyone. I'm doing search using Java and elasticsearch 6.2.2
I'm having some troubles with sorting
The way i need it to be: all exact match sorted by price, with fuzziness 1 sorted by price and then with fuzziness 2 sorted by price.
But now it's just sorting by price, regardless of scoreMatch

// Here is my code
<NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withPageable(pageable)
.withSort(SortBuilders.scoreSort())
.withSort(SortBuilders.fieldSort("prices." + requestDto.getDepartmentId()).order(requestDto.getDirection()))
.withQuery(QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("name", requestDto.getProductName())
.fuzziness(Fuzziness.AUTO).operator(Operator.AND))
.mustNot(QueryBuilders.termsQuery("categoryId", categoryBlackList))
.must(QueryBuilders.termsQuery("categoryId", requestDto.getCategories())))
.build();

    return template.queryForPage(searchQuery, ProductData.class);>

Looking forward for help

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