【问题标题】:elasticdump How do I use offset?elasticdump 如何使用偏移量?
【发布时间】:2019-06-18 15:41:07
【问题描述】:

当 elasticdump 停止并重新启动时,它会尝试在偏移后执行。 但发生错误。

[执行命令]

nohup ./elasticdump --input=http://host/common --output=http://host/common --type=data --limit=1000 --offset=1000 &

[错误]

发出错误 => {"error":{"root_cause":[{"type":"action_request_validation_exception","re​​ason":"验证 失败:1:不允许在滚动中使用 [from] context;"}],"type":"action_request_validation_exception","re​​ason":"验证 失败:1:不允许在滚动中使用 [from] 上下文;"},"状态":400}

如何使用偏移量???

【问题讨论】:

  • 你运行的是哪个版本的 ES?
  • 使用的ES版本是6.6。

标签: elasticsearch


【解决方案1】:

来自elasticdump project中的注释:

如果您使用的是 Elasticsearch 6.0.0 或更高版本,则 scrollContext 中不再允许使用偏移参数

您可以采取的措施来防止这种情况(只要您不跨越10000 limit)就是不使用offset 参数(即没有滚动上下文)并提供一个搜索正文,而不是fromsize 设置,像这样:

nohup ./elasticdump --input=http://host/common --output=http://host/common --type=data --searchBody='{"from": 1000, "size": 1000, "query": { "match_all": {} }}' &

更新:

如果您有超过 10K 条记录并且 elasticdump 容易中途停止,我建议利用 snapshot/restore feature 将数据从一台服务器移动到另一台服务器。

【讨论】:

  • 但是..数据总量一万多条。大约是 1000 万。
  • 好的,但是你想达到什么目的?您使用弹性转储的用例是什么?为什么您只想提取部分数据?
  • 我想将所有数据从一台服务器移动到另一台。
  • 在那种情况下,你为什么需要offset参数呢?简单地让它从 0 运行到 N
  • 这是因为当“elasticdump”停止时,再次执行后又从头开始读取。
猜你喜欢
  • 2021-08-07
  • 1970-01-01
  • 2015-11-24
  • 2014-05-29
  • 1970-01-01
  • 1970-01-01
  • 2014-12-17
  • 2011-09-11
  • 1970-01-01
相关资源
最近更新 更多