[英]How to scroll Data using Scroll API elasticsearch
i am new to elk stack我是麋鹿堆栈的新手
i have tried from this but not getting working flow ..我有试过这个,但没有得到工作流..
for example executed below search query例如在搜索查询下方执行
POST <index-name>/_search?scroll=2m
{
"query": {"match_all": {}}
}
GET /_search/scroll
{
"scroll_id" : "<scroll_id>"
}
"took" : 2,
"timed_out" : false,
"terminated_early" : true,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 13059,
"relation" : "eq"
}
"caused_by" : {
"type" : "search_context_missing_exception",
"reason" : "No search context found for id"
Kibana 7.9.3
Elastic Search 7.9.3
The scroll_id
value changes in every response. scroll_id
值在每个响应中都会发生变化。 So the next search call needs to use the new scroll id from the previous search response.所以下一个搜索调用需要使用上一个搜索响应中的新滚动 ID。
You started correctly with你正确地开始
POST <index-name>/_search?scroll=2m
{
"query": {"match_all": {}}
}
In the response you get, a field called _scroll_id
contains the next scroll id to use for the next call (like a cursor), let's call it scroll_id_1
:在您得到的响应中,名为
_scroll_id
的字段包含用于下一次调用的下一个滚动 ID(如游标),我们称之为scroll_id_1
:
GET /_search/scroll
{
"scroll_id" : "<scroll_id_1>",
"scroll": "2m"
}
In that next response, you get a new _scroll_id
value (let's call it scroll_id_2
) that you need to use it for the next call:在下一个响应中,您将获得一个新的
_scroll_id
值(我们称之为scroll_id_2
),您需要将其用于下一次调用:
GET /_search/scroll
{
"scroll_id" : "<scroll_id_2>",
"scroll": "2m"
}
And you keep doing it until you get an empty result set, at which point you can clear the search context你一直这样做,直到你得到一个空的结果集,此时你可以清除搜索上下文
DELETE /_search/scroll
{
"scroll_id" : "<scroll_id_n>"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.