1

I installed FOSElasticaBundle on Symfony2 to find data on elasticsearch. I followed the instruction, but I have an error and I don't know how to deal with it. The error is as follows:

Notice: Undefined index: bluecoat-syslog

500 Internal Server Error - ContextErrorException

Stack Trace

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(

my controller

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);
}

my 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: ~

the version of the bundle is:

FOSElasticaBundle 3.1.x

Regards and thanks!

Community
  • 1
  • 1
toff
  • 11
  • 3
  • Current FOSElasticaBundle stable version is 3.1.3. Are you sure you did mean 1.3.x version? – Jakub Matczak Apr 20 '15 at 16:47
  • jejeje you are right! my version is 3.1.3. Thanks – toff Apr 20 '15 at 17:32
  • Try quoting `'bluecoat-syslog':` if having a hyphen in your index name is causing the issue. Silly question, but you did run `app/console fos:elastica:populate`, right? :) – Adam Elsodaney Apr 20 '15 at 17:44
  • Silly answer, it's completely necessary? Because I populate elasticsearch with logstash. I only used the FOSElasticaBundle to search – toff Apr 20 '15 at 18:07

1 Answers1

1
  1. change the name of the index by something without -

  2. Don't forget to create your index with the following command php app/console fos:elastica:populate

Amine Jallouli
  • 3,919
  • 8
  • 36
  • 73