dhiman252's avatar

Elasticseach with laravel Eloquent

Hi,

I want to integrate the elasticsearch v2.1.* with laravel 5.1 and i dont know anything about the elastic search and how it works with PHP. I would be very thankful if you provide me this information.

0 likes
6 replies
dhiman252's avatar

Hi,

Thanks for providing me the links, there were really very useful to me.

Now last i have a question: I am using https://github.com/elasticquent/Elasticquent library for elastic search through eloquent models, Now how can my MYSQL database sync with the elasticseach index ?

do i need to run a cron job which will update the index everytime a new row is inserted into table ? Or Does this package https://github.com/elasticquent/Elasticquent supports if a row is inserted into the database it will automatically be inserted into the elasticsearch index ?

noeldiaz's avatar

Here is a pretty short and basic blog post I found the other day that explains some of the concepts to get this going: https://michaelstivala.com/learning-elasticsearch-with-laravel/

Check out the part about hooking up to the model events for saving and deleting. That is what you want for Elastic. You don't need to worry about updates since every time you save you just send the full record when new or update.

1 like

Please or to participate in this conversation.