我使用 spring-data-elasticsearch 框架从 elasticsearch 服务器获取查询结果,java 代码如下:
public void testQuery() {
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withFields("createDate","updateDate").withQuery(matchAllQuery()).withPageable(new PageRequest(0,Integer.MAX_VALUE)).build();
List<Entity> list = template.queryForList(searchQuery, Entity.class);
for (Entity e : list) {
System.out.println(e.getCreateDate());
System.out.println(e.getUpdateDate());
}
}
我在服务器中获取原始查询日志,如下所示:
{"from":0,"size":10,"query":{"match_all":{}},"fields":["createDate","updateDate"]}
根据查询日志,spring-data-elasticsearch 将为查询添加大小限制。"from":0, "size":10
, 我怎样才能避免它添加大小限制?