无法关闭AWS上的ElasticSearch索引?

问题描述 投票:0回答:4

我创建了一个新的 AWS ElasticSearch 域用于测试。我现在在另一台主机上使用 ES,并且希望迁移到 AWS。

我需要做的一件事是在我的实例上设置映射(分析器)。为了做到这一点,我需要“关闭”索引,否则 ES 将引发异常。

但是,每当我尝试关闭索引时,我都会收到来自 AWS 的异常:

Your request: '/_all/_close' is not allowed by CloudSearch.

AWS ES 文档特别指出在某些情况下要执行此操作:

 curl -XPOST 'http://search-weblogs-abcdefghijklmnojiu.us-east-1.a9.com/_all/_close'

我没有找到任何文档说明为什么我无法关闭 AWS ES 上的索引,也没有发现任何其他人遇到此问题。

这也有点奇怪,我有一个 ElasticSearch 域,但它给了我一条 CloudSearch 错误消息,因为我认为这些是不同的服务,尽管我认为一个服务是根据另一个服务实现的。

谢谢!

amazon-web-services elasticsearch
4个回答
12
投票

AWS Elasticsearch 不支持对索引进行“关闭”操作。

http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managementomains.html

“目前,Amazon ES 不支持 Elasticsearch _close API”


1
投票

根据我最近找到的AWS文档,你必须先将你的Elastic Search域升级到7.4或更高版本。

https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-handling-errors.html#aes-troubleshooting-close-api


0
投票

如果您不打算重新索引,您可以通过设置更改和 reindex:

创建一个新索引
PUT my-new-index
{
  "index": {
    "refresh_interval": "5s",
    "blocks": {
      "write": "false"
    },
    "max_result_window": "500000",
    "number_of_replicas": "0",
    // your settings changes
  }
}

然后

POST /_reindex
{
  "source": {
    "index": "my-index"
  },
  "dest": {
    "index": "my-new-index"
  }
}

-2
投票

由于一次关闭所有索引是一项危险的操作,因此您的集群上可能会默认禁用它。您需要确保您的

elasticsearch.yml
配置文件不包含以下内容:

action.destructive_requires_name: true

您可以在配置文件中设置此项并重新启动集群,但我强烈建议您不要这样做,因为这为各种其他破坏性操作打开了大门,例如立即删除所有索引。

action.destructive_requires_name: false

您应该做的是暂时使用

更新集群设置
curl -XPUT localhost:9200/_cluster/settings -d '{
    "persistent" : {
        "action.destructive_requires_name" : false
    }
}'

然后关闭所有索引

curl -XPOST localhost:9200/_all/_close

然后将设置重置为更安全的值:

curl -XPUT localhost:9200/_cluster/settings -d '{
    "persistent" : {
        "action.destructive_requires_name" : true
    }
}'
© www.soinside.com 2019 - 2024. All rights reserved.