У меня есть новая установка 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: Я нашел this вопрос так как это проблема с elasticsearch-PHP или мне нужно обновить его, я думаю,
Я использую elasticquent которые я только что понял, требует elasticsearch-версии PHP < 2,2 так это то, что вызывает проблему
Можете ли вы попробовать изменить? '$ response = $ client-> index() -> putSettings ($ params);' –
, который возвращает 'Elasticsearch \ Common \ Exceptions \ Missing404Exception с сообщением '{" error ": {" root_cause ": [{" type ": "index_not_found_exception", "reason": "no такой индекс", "resource.type": "index_or_alias", "resource.id": "my_index", "index_uid": "_ na _", "index": "my_index"} ], «type»: «index_not_found_exception», «reason»: «no такой индекс», «resource.type»: «index_or_alias», «resource.id»: «my_index», «index_uid»: «_ na _», «index ":" my_index "}," status ": 404} ' ' – user3494047