2017-11-30 1 views
2

elasticsearchクラスタを1.xから6.xにアップグレードしようとしています。私は6.xクラスタにリモート1.xインデックスを再インデックスしています。 the docsによると、これは可能です:Reindex ElasticSearch indexがuri [/ _reindex]とメソッド[GET]に対して正しくないHTTPメソッドを返しました:[POST] "

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リクエストだと思われるようです。どうしてそれが間違ったリクエストタイプを取得しているのか?

+0

この代わりに 'カール-XPOST localhostを試してください:9200/_reindex --data-バイナリの@ reindex.json'を – Val

答えて

0

私は同じ問題に直面していましたが、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

関連する問題