ElasticSearch: Deep diving into Mozilla's MakeAPI - Part 2

Since working on the MakeAPI requires some understanding of ElasticSearch, I've decided to share what I've learned about it.

Elastic Search uses the industry standard Lucene for its search. I will explain more about Lucene in a later blog post.

How it works?
It buffers a lot of data so it can do more operations at once.

By default it refreshes every second so if you update a record it will display in a second which is excellent.

With its intelligent search technology you can find synonyms to words used in search.

Example of synonym:

'argue' => ['bicker', 'quarrel','squabble', ....  ]

You can get suggestions to search terms or correct misspellings. This is similar to how google corrects your mistakes in there search:

ElasticSearch maps your data and has sane defaults but you can over ride it. For the MakeAPI its mappings the columns of data to the following:
To reproduce this just type in your teminal: curl -XGET http://localhost:9200/makes/make/
ElasticSearch doesn't have any authentication so our MakeAPI uses hawk to authenticate users.

What is the difference between a query and a filter?

Query: A query is a simple Lucene search across index's which return a search.

Filter: The results of a query that has been executed is stored in memory with a very efficient data structor called a bitset. Then when we perform a search that goes with the filter we compare all the documents with the filter bitset and it enables us to find the correct match.


Popular Posts