Creating an index with Elasticsearch 5.0 throws a

2019-06-07 09:27发布

I use Elasticsearch 2.4 and I decided to test my code with Elasticsearch 5.0.

So, I installed Elasticsearch 5.0, started it and then tried to use my PHP function that creates an index and populates it.

But I get this error :

 Elasticsearch\Common\Exceptions\BadRequest400Exception
 No handler found for uri [/devmaestro_fr_articles] and method [POST]

And this one :

 Guzzle\Http\Exception\ClientErrorResponseException
 Client error response
[status code] 400
[reason phrase] Bad Request
[url] http://localhost:9200/devmaestro_fr_articles

If I use the same PHP function with Elasticsearch 2.4, it works fine. So, do you have any idea about this problem? Is the way to create an index into Elasticsearch 5.0 different than Elasticsearch 2.4?

I'm developing a web app based on Zend Framework.

1条回答
Evening l夕情丶
2楼-- · 2019-06-07 09:42

It used to be possible to create an index using either POST or PUT, but since the Pull Request #20001, it is not possible anymore to use POST and only PUT is allowed.

So you simply need to change POST with PUT in your code and it should work.

查看更多
登录 后发表回答