我有全新安装的elasticsearch 5.0.0和elasticsearch-php。我正在尝试创建索引。elasticsearch-php创建索引返回 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
编辑工作的这段代码:我发现this问题,以便它要么是elasticsearch-PHP的问题,或者我需要更新它,我想
我使用elasticquent我刚刚意识到需要elasticsearch的PHP版本< 2.2,所以这是什么原因造成的问题
你可以尝试改变放? ''“error”:{“root_cause”:[{“type”:} - > 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