请教一个 Java 查询 elasticsearch 的问题

查看 22|回复 0
作者:zshineee   
//代码
Long startTime = System.currentTimeMillis()
SearchResponse searchResponse = restHighlevelclient.search(searchRequest, RequestOptions.DEFAULT);
Long endTime = System.currentTimeMillis();
log.info("took time:{},execution time:{}",searchResponse.getTook() , (endTime - startTime) + "ms"):
//日志
took time:20ms ,execution time:80ms
took time:19ms ,execution time:77ms
took time:48ms ,execution time:349ms
took time:18ms ,execution time:65ms
took time:34ms ,execution time:884ms
took time:19ms ,execution time:59ms
took time:16ms ,execution time:55ms
took time:19ms ,execution time:1113ms
tookt ime:24ms ,execution time:65ms
tookt ime:16ms ,execution time:56ms
tookt ime:16ms ,execution time:909ms
索引总条数是 2w 条数据,查询条数是 1w 条,实际返回 6000 多条,条件很简单就一个 match ,发现代码实际执行时间不太稳定,应该不需要 1s ,请教下是什么原因?该怎么排查?
您需要登录后才可以回帖 登录 | 立即注册

返回顶部