填充FOSElasticaBundle/Symfony2时ResponseExeption出错

Roy*_*sen 6 exception symfony elastica foselasticabundle

我想让FOSElasticaBundle工作.ElasticSearch Instance正在localhost:9200上运行并响应.

我按照文档中的每一步https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md

但在最后一步,我在我的控制台中收到此错误:

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]
Run Code Online (Sandbox Code Playgroud)

看起来"__construct"-Function必须有3个参数,但只有2个参数.我只是尝试添加"NULL"参数以使其工作,但随后另一个函数抛出错误.

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

这是个常见的问题吗?我该如何解决?

Ani*_*nil 7

这是因为ruflin/Elastica包与elasticsearch 2.0不兼容.

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

现在的替代方案(直到ruflin/Elastica升级2.0),是使用最新的1.x版本.

你可以在这里下载:https://www.elastic.co/downloads/past-releases/elasticsearch-1-7-3

ES 1.7.3 + FosElasticaBundle(使用ruflin/Elastica)适用于Elasticsearch 1.7.3版本.