【发布时间】:2021-02-04 17:03:30
【问题描述】:
我有带有 Spring Boot 和弹性搜索的应用程序。
对于搜索,我使用来自org.springframework.data.elasticsearch.repository.ElasticsearchRepository的 ElasticsearchRepository@
如何通过分页搜索所有字段?
现在我的代码如下所示:
public interface ElasticRepo extends ElasticsearchRepository<ModelDao, Long> {
@Query("{\"query\": {\"match\": {\"_all\": \"?\"}}}")
Page<ModelDao> findByAllUsingCustomQuery(String name, Pageable pageable);
}
我使用这个接口作为:
@Autowired
private ElasticRepo elasticRepo;
public Page<TransportationRequestDao> getOrdersPageable(Pageable pageable, String q) {
return elasticRepo.findByAllUsingCustomQuery(q, pageable);
}
我从 HTTP 查询调用这个方法(getOrdersPageable)
但我得到了没有结果的答案。
你能帮帮我吗?
【问题讨论】:
标签: java spring spring-boot elasticsearch spring-data