使用@Query注解

Example 38. Declare query at the method using the @Query annotation.(使用@Query注解声明查询)

public interface BookRepository extends ElasticsearchRepository<Book, String> {
    @Query("{"bool" : {"must" : {"field" : {"name" : "?0"}}}}")
    Page<Book> findByName(String name,Pageable pageable);
}