我在Symfony2上安装了FOSElasticaBundle来查找elasticsearch上的数据。我按照说明操作,但我有一个错误,我不知道如何处理它。错误如下:
注意:未定义的索引:bluecoat-syslog
500内部服务器错误 - ContextErrorException
堆栈跟踪
in vendor/friendsofsymfony/elastica-bundle/Transformer/ElasticaToModelTransformerCollection.php at line 56 -
$transformed = array();
foreach ($sorted as $type => $objects) {
* $transformedObjects = $this->transformers[$type]->transform($objects);
$identifierGetter = 'get'.ucfirst($this->transformers[$type]->getIdentifierField());
$transformed[$type] = array_combine(
array_map(
我的控制器
public function reportAction(Request $request)
{
$finder = $this->container->get('fos_elastica.finder.log');
$results = $finder->find('ERROR');
$parameters = array("results" => $results);
return $this->render('MyBundle:Core:report.html.twig', $parameters);
}
我的config.yml
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
log:
client: default
index_name: log-2015.04.20
finder: ~
types:
bluecoat-syslog:
mappings:
message: ~
捆绑包的版本是:
FOSElasticaBundle 3.1.x
问候并感谢!
答案 0 :(得分:1)
通过不带-
不要忘记使用以下命令创建索引
php app/console fos:elastica:populate