不允许为Elasticsearch重新编制索引? [英] Not allowed to reindex Elasticsearch?

查看:122
本文介绍了不允许为Elasticsearch重新编制索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了我的AWS Elasticsearch实例,以便任何人都可以对其执行任何操作(创建,删除,搜索等).

I've set my AWS Elasticsearch instance so that anyone can do anything (create, delete, search, etc.) to it.

这些是我的权限(将$ myARN替换为我的Elasticsearch ARN):

These are my permissions (replace $myARN with my Elasticsearch ARN):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": "$myARN"
    }
  ]
}

当我PUT新索引时:

 PUT http://my-elasticsearch-domain.us-west-2.es.amazonaws.com/index-name

或者我DELETE一个索引:

 DELETE http://my-elasticsearch-domain.us-west-2.es.amazonaws.com/index-name

我明白了:

{
  "acknowledged": true
}

这意味着我可以创建和删除索引,但是当我尝试POST重新索引时,我得到:

Which means I can create and delete indexes but when I try to POST a reindex I get:

{
  "Message": "Your request: '/_reindex' is not allowed."
}

我必须签署此请求吗?为什么我必须签署此请求但不创建或删除索引?

Do I have to sign this request? Why should I have to sign this request but not creating or deleting indexes?

推荐答案

原因仅是因为Amazon Elasticsearch Service是一种受限环境,您无法访问由Amazon Elasticsearch Service提供的全部服务和终端节点.准系统安装Elasticsearch.

The reason is simply because the Amazon Elasticsearch Service is a kind of restricted environment where you don't have access to the full range of services and endpoints provided by a barebone install of Elasticsearch.

您可以查看列表允许在Amazon Elasticsearch Service上使用的终端节点,而_reindex不在该列表中.

You can check the list of endpoints that you're allowed to use on the Amazon Elasticsearch Service and _reindex is not part of that list.

更新

不过,还有另一种方法可以实现您想要的.通过使用Logstash,您可以从ES中获取数据,应用所需的任何转换,然后将其吸收回ES.

There's another way to achieve what you want, though. By leveraging Logstash, you can source the data from ES, apply any transformation you wish and sink it back to ES.

input {
  elasticsearch {
   hosts => ["my-elasticsearch-domain.us-west-2.es.amazonaws.com:80"]
   index => "index-name"
   docinfo => true
  }
}
filter {
 mutate {
  remove_field => [ "@version", "@timestamp" ]
 }
 # add other transformations here
}
output {
 elasticsearch {
   hosts => ["my-elasticsearch-domain.us-west-2.es.amazonaws.com:80"]
   manage_template => false
   index => "%{[@metadata][_index]}"
   document_type => "%{[@metadata][_type]}"
   document_id => "%{[@metadata][_id]}"
 }
}

这篇关于不允许为Elasticsearch重新编制索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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