1 java Api中只能显示10条检索出来的数据
这是es高级客户端的默认配置,通过size修改即可
SearchSourceBuilder builder = new SearchSourceBuilder();
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
...
builder.query(boolQuery).size(9999);
2 es检索到10000条以上数据就会抛错
错误日志:
Result window is too large, from + size must be less than or equal to:[10000] but was [10500]. See the scroll api for a more efficient way to requestlarge data sets. This limit can be set by changing the[index.max_result_window] index level parameter
原因:这是es官方默认限制索引查询最多只能查询10000条数据 解决: 第一种办法.在kibana中执行,修改索引最大查询数的限制 修改全部索引: put _all/_settings { “index.max_result_window”:200000 } 修改单个索引 PUT /us_tm_info_v1/_settings { “index.max_result_window”: “20000” }
第二种方式 在config/elasticsearch.yml文件中的最后加上 index.max_result_window: 100000000
|