Search code examples
spring-bootspring-data-elasticsearch

How to pass sort by _score in springboot elastic search in @Query param


@Query("{\"multi_match\": {\"query\": \"?0\", \"fields\": [\"field1\", \"field2\",\"field3\",\"field4\"], \"fuzziness\": \"AUTO\"}}")
Page<ElasticRecipe> findBySearchQueryAutoComplete(String searchTerm, Pageable pageable);

spring-data-elasticsearch : version 5.0.1, springboot : 3.0.2, java : 19


Solution

  • That should be possible by adding a Sort parameter as 3rd one and setting it when calling the method, but it's not implemented. I just created an issue for that and will fix this.