Elasticsearch scroll常见错误
最近使用es嘎嘎报错:
Trying to create too many scroll contexts. Must be less than or equal to: [500]
- 原因:在search()中设置的timeout时间内,累计生成的scroll_id数超过了最大限制
- 解决方法:查询scroll以后,删除对应的id,即调用clearScroll方法
//搜索查询 $response = $this->client->search($params); while (isset($response['hits']['hits']) && count($response['hits']['hits']) > 0) { //对response内容进行处理 $scroll_id = $response['_scroll_id']; // Execute a Scroll request and repeat $response = $this->client->scroll([ 'scroll_id' => $scroll_id, //游标id 'scroll' => $timeout //超时时间 ]); } //清除scroll_id $this->client->clearScroll(array('scroll_id' => $response['_scroll_id']));
本文来自博客园,作者:Carvers,转载请注明原文链接:https://www.cnblogs.com/carver/articles/17683678.html

浙公网安备 33010602011771号