私はelasticsearch 5.0.0とelasticsearch-phpを新しくインストールしました。私はインデックスを作成しようとしています。elasticsearch-php create indexは BadRequest400Exceptionを返します
私はthisインデックス管理ドキュメントからのコード実行:
$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index'
];
// Create the index
$response = $client->indices()->create($params);
をし、それが動作します。私は正常にインデックスを作成します。
私は次のコードスニペット試してください:
$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index',
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'my_type' => [
'_source' => [
'enabled' => true
],
'properties' => [
'first_name' => [
'type' => 'string',
'analyzer' => 'standard'
],
'age' => [
'type' => 'integer'
]
]
]
]
]
];
// Create the index with mappings and settings now
$response = $client->indices()->create($params);
をし、私が手:
Elasticsearch\Common\Exceptions\BadRequest400Exception with message 'No handler found for uri [/my_index] and method [POST]'
任意のアイデアなぜですか?
私はelasticsearch 2.0
EDITを使用したときに動作するために使用されるこのコードは:それはelasticsearch-PHPの問題ですか、私は私がelasticquentを使用しています
を推測、それを更新する必要がありますいずれかのように、私はthis質問を見つけましたこれは私がちょうど実現したelasticsearch-PHPのバージョンが必要です< 2.2ので、これはエラーメッセージを見ると、問題
入れ替えることができますか? '{" error ":{" error_cause ":{{" type ":}}を返す' $ response = $ client-> indices() - > putSettings($ params); ' –
これは' Elasticsearch \ Common \ Exceptions \ Missing404Exceptionを返す ' 「index_not_found_exception」、「reason」:「no such index」、「resource.type」:「index_or_alias」、「resource.id」:「my_index」、「index_uuid」:「_ na _」、「index」:「my_index」} ]、 "type": "index_not_found_exception"、 "reason": "no such index"、 "resource.type": "index_or_alias"、 "resource.id": "my_index"、 "index_uuid": "_ na _"、 "index ":" my_index "}、" status ":404} ' ' – user3494047