gpt4 book ai didi

elasticsearch - 重新索引ElasticSearch索引返回 “Incorrect HTTP method for uri [/_reindex] and method [GET], allowed: [POST]”

转载 作者:行者123 更新时间:2023-12-02 22:37:03 24 4
gpt4 key购买 nike

我正在尝试将Elasticsearch集群从1.x升级到6.x。我正在将远程1.x索引重新索引到6.x群集中。根据the docs,这是可能的:

To upgrade an Elasticsearch 1.x cluster, you have two options:

  • Perform a full cluster restart upgrade to Elasticsearch 2.4.x and reindex or delete the 1.x indices. Then, perform a full cluster restart upgrade to 5.6 and reindex or delete the 2.x indices. Finally, perform a rolling upgrade to 6.x. For more information about upgrading from 1.x to 2.4, see Upgrading Elasticsearch in the Elasticsearch 2.4 Reference. For more information about upgrading from 2.4 to 5.6, see Upgrading Elasticsearch in the Elasticsearch 5.6 Reference.

  • Create a new 6.x cluster and reindex from remote to import indices directly from the 1.x cluster.


我出于测试目的在本地执行此操作,并在运行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"
}
}
但是,这将返回以下错误:

Incorrect HTTP method for uri [/_reindex] and method [GET], allowed: [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

关于elasticsearch - 重新索引ElasticSearch索引返回 “Incorrect HTTP method for uri [/_reindex] and method [GET], allowed: [POST]”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47578375/

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