【问题标题】:curl command to close all indices at once in elastic searchcurl命令在弹性搜索中一次关闭所有索引
【发布时间】:2020-05-21 02:27:53
【问题描述】:

我正在弹性搜索集群中恢复快照,但在恢复之前,我需要关闭所有打开的索引。我找到的关闭索引的命令是curl -XPOST "localhost:9200/twitter/_close",它只关闭一个索引twitter。我有一长串开放索引,每次都调用这个命令,这不是一个可行的解决方案。有没有人有任何想法让它更容易?

【问题讨论】:

    标签: curl elasticsearch backup restore


    【解决方案1】:
    curl -XPOST "localhost:9200/_all/_close"
    

    使用_all 选择所有索引。

    【讨论】:

    • 是否有任何额外的更改需要执行此命令后我收到以下错误-{"error":"RemoteTransportException[[Bobster][inet[/10.20.35.2:9300]][indices:admin/close]]; nested: IndexMissingException[[_all] missing]; ","status":404}
    • 您使用的是哪个弹性搜索?不支持0.9.X版本,见:官方文档:elastic.co/guide/en/elasticsearch/reference/5.2/…
    • 版本为 1.6.X
    【解决方案2】:

    这解决了我的问题:

    curl -XPOST "localhost:9200/_all/_close"

    快照未恢复,并抛出SnapshotRestoreException

    【讨论】:

      【解决方案3】:

      根据documentation,您可以关闭所有索引:

      $ curl -XPOST "localhost:9200/_all/_close"
      

      如果您收到有关缺少索引的错误,您可以使用以下参数忽略它们:

      $ curl -XPOST "localhost:9200/_all/_close?allow_no_indices=true&expand_wildcards=all"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-05-12
        • 1970-01-01
        • 2018-11-25
        • 1970-01-01
        • 2018-08-20
        • 1970-01-01
        • 1970-01-01
        • 2016-10-24
        相关资源
        最近更新 更多