What is the *right* way to setup Elasticsearch on a service?

I've used elasticsearch before on a small project. The project basically cataloged threads from a forum and presented them in a listview. I enabled search by connecting Elasticsearch through my MongoDB server via a Go daemon (Monstache). It worked but it felt fairly unintuitive and I couldn't help but think I was doing this the wrong way. Now I'm working on a new project and I actually use a SQL database instead to keep data, so I don't think the same trick can work again. So I have this question: what is the right way to setup Elasticsearch on a service? In other words, how should I connect Elasticsearch to my data? Should I simply dump the existing data in my SQL tables as documents into Elasticsearch? Should I only dump select information from each record (e.g. the necessary metadata) and store that in Elasticsearch? What happens when a new record is made? Do I index it immediately into Elasticsearch or do I collect a few new records and then batch insert it into Elasticsearch?

This is kind of a broad question, I understand. I just want to know what the normal way about it is. How does ELK typically fit into an existing application? I welcome guides, documentation, and best practice advice.


I shared most of my thoughts there: http://david.pilato.fr/blog/2015/05/09/advanced-search-for-your-legacy-application/

Basically, I'd recommend modifying the application layer if possible and send data to elasticsearch in the same "transaction" as you are sending your data to the database.

So I basically just create an ElasticSearch bean (DAO) and couple it within my EntityService class. Whenever I create a new Entity, I'll also create it within ElasticSearch itself. So for each record in my SQL table, there's a coexisting document within Elasticsearch. This is better than an ETL as I get realtime searching.

One more question: if someone is building a service from the ground up and wants to incorporate elasticsearch, do they do the same thing (if they're sticking to a SQL database)? This guide is extremely helpful, by the way.

I think so.

A "recent" version of the video is here:


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.