我正在尝试将elasticsearch集群从1. x升级到6.x。我正在将远程1.x索引重新索引到6.x集群中。根据文档,这是可能的:
要升级Elasticsearch 1. x集群,您有两个选择:
>
执行完整集群重启升级到Elasticsearch 2.4. x,并重新索引或删除1.x索引。然后,执行完整集群重启升级到5.6,并重新索引或删除2.x索引。最后,执行滚动升级到6.x。有关从1.x升级到2.4的更多信息,请参阅Elasticsearch 2.4参考中的升级Elasticsearch。有关从2.4升级到5.6的更多信息,请参阅Elasticsearch 5.6参考中的升级Elasticsearch。
创建一个新的6. x集群并从远程重新索引以直接从1.x集群导入索引。
出于测试目的,我在本地执行此操作,并在运行6. x时使用以下命令:
curl --request POST localhost:9200/_reindex -d @reindex.json
我的reindex. json文件如下所示:
{
"source": {
"remote": {
"host": "http://localhost:9200"
},
"index": "some_index_name",
"query": {
"match": {
"test": "data"
}
}
},
"dest": {
"index": "some_index_name"
}
}
但是,这会返回以下错误:
uri[/_reindex]和方法[GET]的HTTP方法不正确,允许:[POST]"
为什么它告诉我我不能使用GET并改用POST?我在这里明确指定了一个POST请求,但它似乎认为这是一个GET请求。知道为什么它得到了错误的请求类型吗?
我也遇到了同样的问题,但是通过在PUT请求中添加设置,它起到了作用。
PUT /my_blog
{
"settings" : {
"number_of_shards" : 1
},
"mapping": {
"post": {
"properties": {
"user_id": {
"type": "integer"
},
"post_text": {
"type": "string"
},
"post_date": {
"type": "date"
}
}
}
}
}
你也可以参考这个-https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html