Question

Indexing things in ElasticSearch using FOSElasticaBundle doesn't work.

Here is from my config (app/config/config.yml):

fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    serializer:
        callback_class: FOS\ElasticaBundle\Serializer\Callback
        serializer: serializer
    indexes:
        website:
            client: default
            types:
                idea:
                    mappings:
                        title: { boost: 6 }
                    persistence:
                        driver: orm
                        model: Ideside\IdeaBundle\Entity\Idea
                        provider: ~
                        finder: ~
                        listener: ~ 

When I comment away all of this, making it so that things are not indexed in ES, everything will work fine. But when this is present in the config.yml-file, and I post an entity using a form, the computer fan will go like crazy for two minutes and the following response will be returned:

"FatalErrorException: Error: Maximum execution time of 120 seconds exceeded"

So we are alone in the universe...

When I change the config.yml-settings so that the specific entity that I'm posting isn't among the ones being indexed to ES everything will work fine, but indexing just one database-row in ES can be enough to bring the server to a halt it seems.

The php app/console fos:elastica:populate-command will finish if the database is empty, and I also made it work once or twice with one database-row being indexed to ES, but with even quite modest amounts of data in the database the fan will run like crazy for minutes without going past Resetting website (the first line the terminal prints when running the populate-command).

Things that may help in understanding what the problem is:

  • I have made ES-integration work successfully in this project before. Indexing the database, indexing new things being added to the database, searching in ES - everything worked like a charm it seemed. But the ES-integration was kept on a specific git-branch that has not been merged with the main project before now, and now it doesn't work anymore.

  • Prior to merging the ES-integrated branch with the master-branch the master-branch, the master-branch has among other things made use of the FOSRestBundle.

  • Other people on the team who have pulled the master-branch have had the same problem, so it seems that the problem is with the project code, and not with my ElasticSearch-node (although I can't be sure).

Do any of you have any idea what might be wrong? Any help would be deeply appreciated!

If more info or more sections of code can be of help for identifying what is wrong I will of course gladly provide you with this.

Was it helpful?

Solution

The problem was caused by circular references when objects where serialized: http://en.wikipedia.org/wiki/Circular_reference.

If you have a similar problem you can solve it by modifying which properties that are serialized by using annotations: http://jmsyst.com/libs/serializer/master/reference/annotations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top