How to set 'refresh' parameter to 'true' while indexing documents when using FOSElasticaBundle?

446 Views Asked by At

How can I setup 'refresh=true' parameter for document indexing when using FOSElasticaBundle with Symfony framework? We need to see updated document immediately in search result as described in doc here

REST example:

curl -XPUT 'http://localhost:9200/{index}/{type}/{id}?refresh=true' -d '{
  "property" : "value"
}'
1

There are 1 best solutions below

1
On

What u need is official FOSElasticaBundle documentation not ELASTICA documentation. here is the doc : https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/types.md

Take a look at the listener part :

persistence:
                    listener:
                        insert: true
                        update: false
                        delete: true

But be aware u ll need more CPU/RAM resssources, as each time, you ll persist an entity indexed by ElasticSearch, ElasticSearch will perform an indexation of freshly updated entity.

for a nicely tutorial with foselasticabundle and elasticSeach integration in Symfony2, you can have a look here :

http://obtao.com/blog/2014/02/indexing-and-simple-search-with-elasticsearch-and-symfony/