gpt4 book ai didi

elasticsearch - 删除所有具有相似名称的索引

转载 作者:行者123 更新时间:2023-12-02 22:19:01 28 4
gpt4 key购买 nike

大家好,我的 elasticsearch 有 100 个索引,我想用一个查询删除它们。它们都以 myindex 开头:

myindex-1
myindex-2
myindex-3
myindex-4
.
.
.
myindex-100

当我尝试此查询时,它不起作用:
curl -XDELETE http://localhost:9200/myindex*

我得到:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Wildcard expressions or all indices are not allowed"}],"type":"illegal_argument_exception","reason":"Wildcard expressions or all indices are not allowed"},"status":400}

你有什么主意吗?

最佳答案

Elasticsearch documentation说:

The delete index API can also be applied to more than one index, by either using a comma separated list, or on all indices (be careful!) by using _all or *as index.

In order to disable allowing to delete indices via wildcards or _all, set action.destructive_requires_namesetting in the config to true. This setting can also be changed via the cluster update settings api.


因此,如果您有预定义数量的索引要删除,这可能会起作用:
curl -XDELETE http://localhost:9200/myindex-1,myindex-2,myindex-3,myindex-4
如果您想使用通配符,则必须按照上述方式更新配置

关于elasticsearch - 删除所有具有相似名称的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45987172/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com