使用@Query注解

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

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