为什么这个ElasticSearch扫描和滚动保持返回相同的滚动ID? [英] Why does this ElasticSearch scan and scroll keep returning the same scroll id?

查看:289
本文介绍了为什么这个ElasticSearch扫描和滚动保持返回相同的滚动ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先我运行以下内容:

  curl -s -XGET http:// localhost:9200 / my_index / _search ?scroll = 1m& search_type = scan& size = 10 

这将返回一个滚动ID,然后我使用在第一个滚动请求中:

  curl -s -XGET http:// localhost:9200 / _search / scroll?scroll = 1m& ; scroll_id =< scroll_id from above> 

文档将导致我相信,当我运行第二卷曲请求时,我应该得到一个新的滚动ID。



但是,它看起来像是不断得到相同的滚动ID。



看起来每个请求的数据不同,所以我假设一切正常。



发生了什么?

解决方案

你以上所说的是正确的。



scroll_id在后续的滚动请求中可能会有所不同,也可能不一样。但结果集(命中)在随后的滚动调用中是绝对不同的。



scroll_id可能会在多次调用过程中更改,因此需要始终将最近的scroll_id作为随后请求的scroll_id传递。 b $ b

So first I run the following:

curl -s -XGET http://localhost:9200/my_index/_search?scroll=1m&search_type=scan&size=10

This returns a scroll id which I then use in the first scroll request:

curl -s -XGET http://localhost:9200/_search/scroll?scroll=1m&scroll_id=<scroll_id from above>

The documentation would lead me to believe that when I run the 2nd curl request, I should get a new scroll id.

However, it looks like I keep getting the same scroll id back.

It looks like the data coming back is different for each request so I'm assuming that everything is working.

What is going on?

解决方案

What you have above is correct.

The scroll_id may or may not be the same across subsequent scroll request. But the result set (hits) is definitively different in subsequent scroll calls .

The scroll_id may change over the course of multiple calls and so it is required to always pass the most recent scroll_id as the scroll_id for the subsequent request.

这篇关于为什么这个ElasticSearch扫描和滚动保持返回相同的滚动ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆