Search code examples
spring-data-elasticsearch

Custom rescorer on NativeSearchQuery


I installed a custom rescorer plugin on Elasticsearch but I couldn't find a way to call it by using ElasticsearchOperations. I'm using the NativeSearchQuery built by a NativeSearchQueryBuilder but I could only find a method to add a QueryRescore and not a custom one. Is there a way to use a custom rescorer plugin?


Solution

  • Actually I don't see such a possibility in the code of org.elasticsearch.search.builder.SearchSourceBuilder. There is the method addRescorer(RescorerBuilder<?> rescoreBuilder) but the only RescorerBuilder that Elasticsearch offers is the org.elasticsearch.search.rescore.QueryRescorerBuilder.

    So for Spring Data Elasticsearch there is currently no way to add custom rescorers.