声明:本博客根据ES官方文档6.3版本内容翻译总结整理而成,转载请注明出处:https://blog.youkuaiyun.com/qingmou_csdn
前期准备:创建索引、写入数据
DELETE gaoyh
PUT gaoyh
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"gtest":{
"properties": {
"user":{
"type": "text",
"fields": {
"raw":{
"type": "keyword"
}
}
},
"interest":{
"type": "keyword",
"doc_values":false,
"norms": false
},
"create_time":{
"type":"date"
}
}
}
}
}
POST gaoyh/gtest/_bulk
{"index":{"_id":"1"}}
{"user":"tom","interest":"music","create_time":"2018-07-17"}
{"index":{"_id":"2"}}
{"user":"kit","interest":"sport","create_time":"2018-07-17"}
{"index":{"_id":"3"}}
{"user":"nio","interest":"climb","create_time":"2018-07-

本文介绍了如何使用Elasticsearch的Scroll参数进行数据滚动获取。首先,需要在查询时设置scroll参数,如?scroll=1m,以保持搜索上下文活跃。响应会包含_scroll_id,用于后续滚动API请求获取下一批结果。通过调整size参数控制每次返回的命中数,当hits数组为空时,表示所有数据已获取完毕。最后,可使用_all参数清除所有搜索上下文。
最低0.47元/天 解锁文章
694

被折叠的 条评论
为什么被折叠?



