Reputation: 8661
I am building a REST api using Laravel for a mobile app. And now I need a search engine.
First off, I have never used any search engine. So I am looking for one thats simple to work with but still good at fulltext searching and filtering "where"
The table I want to perform searches on has 1 column (varchar45) that needs to be search by fulltext search, and then there is 5 columns (int) thats used to filter using a "where" statement.- Using the mysql approach. I also perform a inner join on that table in order to print out some other stuff when generating the result.
So I looked at sphinx and Elasticsearch, and decided to go with ES.
I have watched the ES intro form Laracon: https://www.youtube.com/watch?v=waTWeJeFp4A
and I also took a look at this package: https://github.com/freekmurze/searchindex
That left me with a few questions:
1) Do I drop my mysql DB and just store ALL my data in ES?
2) If 1-yes, can I still use my mysql DB and just use ES to store indexes? - Since I only have to perform a search on one table (search a total of 5 rows).
3 If 2-yes, Do I still keep my current indexes in my mysql table? Eg, fulltext index on title column, FK on another column and index on 3 others.
4 Since this is the first time I ever use a search engine, is there any other tutorial/book/snippet out there on how to use ES with Laravel?
Thanks in advance
Upvotes: 9
Views: 17328
Reputation: 901
I was solving the same issues recently. My opinions:
1. no. definitely keep your DB for storing data. ES wasn't built to replace your database. it is (mostly) search engine.
4. you can find nice tutorial here: http://www.fullstackstanley.com/read/simple-search-with-laravel-and-elasticsearch (as a starting point).
I suggest you to read also http://www.elasticsearch.org/guide/en/elasticsearch/guide/ (to understand ES better)
Upvotes: 11