RLW-1 Elastic Search

Elastic search is a software which helps in making your content searchable.

Say your friend is a movie buff and he has written reviews and articles about many movies in various genres. Now say he wants to look at the horror movies his favorite start has acted in. He sees that he has no easy way to do it without going through the archives one by one. He already has tags for horror and by the name of the star but he can only search by one tag at a time. He wishes there was a way he could search for this. He finds his answer in Elastic search.

With Elastic search he can index all his posts and then use it’s powerful query dsl to search for exactly what he wants.

When you index a document into ES it analyzes the fields in the document and builds an inverted index. What that means is for each word on the document it keeps a map of which documents that word is there. So when you search for a word or can quickly look up the document it is available on and then return it.

Now this is a crude way of how it works. Coming back to the movie example above, how does it make sense of actor and genre if it just keeps an inverted​ index of all the words. The answer of this is mapping. I haven’t explained how the document is analyzed before. ES takes a json document as input. So you specify different fields with information for each in the document. ES keeps an inverted index for each field. That way we can use the field name while querying to search for the exact field.