我用滚动来查询ES,但我仍然有10条记录,我的查询如下:
curl -XGET 'http://10.0.0.5:9200/myin/app/_search?scroll=1m' -d '{
"_source": "appAd",
"query": {
"bool": {
"must_not": {
"term": {
"app.raw": "dt"
}
}
}
}
以下是结果:
"took":467,"_shards":{"total":24,"successful":24,"failed":0},"hits":{"total":760000} ...
但它只返回10条记录,虽然它达到760000。
答案 0 :(得分:3)
您需要使用查询结果中返回的scroll_id调用滚动API,以获取下一组结果。继续通话直到所有结果都已处理完毕。
curl -XGET 'localhost:9200/_search/scroll' -d'
{
"scroll" : "1m",
"scroll_id" : "c2Nhbjs2OzM0NDg1ODpzRlBLc0FXNlNyNm5JWUc1"
}
'
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html