Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in ResponseExeption while populating FOSElasticaBundle/Symfony2

I am trying to get FOSElasticaBundle to work. ElasticSearch Instance is running on localhost:9200 and responding.

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

but at the last step, I get this error in my 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 like there are 3 parameters mandatory for "__construct"-Function, but there are only 2 of them. I've simply tried to add "NULL"-parameter to get it work, but then another function throws 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 do I solve it?

like image 908
RoyRobsen Avatar asked Oct 20 '15 06:10

RoyRobsen


1 Answers

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

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

An alternative for now (until ruflin/Elastica is 2.0 upgraded), is to use the latest 1.x version.

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 fine with Elasticsearch 1.7.3 version.

like image 113
Anil Avatar answered Nov 15 '22 09:11

Anil