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.fieldSort("prices." + requestDto.getDepartmentId()).order(requestDto.getDirection()))
.must(QueryBuilders.matchQuery("name", requestDto.getProductName())
.mustNot(QueryBuilders.termsQuery("categoryId", categoryBlackList))
.must(QueryBuilders.termsQuery("categoryId", requestDto.getCategories())))

    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.