Spring-Data elastic search repo count with custom @Query annotation not working “Expected 1 but found 30 results”
问题 For my application I have to perform a custom count on elastic, I want to use the @Query annotation for this in the ElasticsearchCrudRepository we use. When I use the following signature: @Query("CUSTOM BOOL QUERY HERE") long countItemsCustom(); This leads to a java.lang.IllegalArgumentException: Expected 1 but found 30 results Exception since it is executed as an query instead of an count. For spring-data-cassandra we have a special @CountQuery annotation to solve this issue. Is there a