Error in ResponseExeption when populating FOSElasticaBundle / Symfony2

I am trying to get FOSElasticaBundle to work. An ElasticSearch instance runs on localhost: 9200 and responds.

I followed every step in the docs https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md

but in the last step I get this error in the console:

c:\xampp\htdocs\my\folder>php app/console fos:elastica:populate Resetting app Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in C:\xampp\htdocs\my\folder\vendor\rufli n\elastica\lib\Elastica\Exception\ResponseException.php on line 34 [Symfony\Component\Debug\Exception\FatalErrorException] Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) fos:elastica:populate [--index[="..."]] [--type[="..."]] [--no-reset] [--offset="..."] [--sleep="..."] [--batch-size="..."] [--ignore-errors] [--no-overwrite-format] 

It seems that 3 parameters are required for the "__construct" function, but there are only 2 of them. I just tried to add a "NULL" parameter to make it work, but then another function causes an error.

 public function __construct(Request $request, Response $response) { $this->_request = $request; $this->_response = $response; parent::__construct($response->getError()); } 

Is this a common problem? How to solve it?

+6
source share
2 answers

This is because ruflin / Elastica is not yet compatible with elasticsearch 2.0.

https://github.com/ruflin/Elastica/issues/946

The alternative at the moment (until ruflin / Elastica is updated to 2.0), you should use the latest version 1.x.

You can download it here: https://www.elastic.co/downloads/past-releases/elasticsearch-1-7-3

ES 1.7.3 + FosElasticaBundle (which uses ruflin / Elastica) works great with Elasticsearch 1.7.3.

+7
source

The reason for this problem is that with elasticsearch 2.0 the structure of the response error has changed (more details here: https://github.com/ruflin/Elastica/issues/946 ). Instead of a string before it is now a nested array. Elastica is not yet fully compatible with elasticsearch 2.0. As soon as a new version of Elastica compatible with Elasticsearch 2.0 is released, this probably means that the foselastica service pack should also be updated, as these changes will violate backward compatibility. Also keep in mind that this is not the only change in the backward compatibility gap.

To monitor the progress of the update, follow this issue: https://github.com/ruflin/Elastica/issues/946

+4
source

All Articles