If you haven’t heard of Elasticsearch, we highly recommend you read up about it. TECKpert has recently started using Elasticsearch and is finding more ways to put it to use. As Elasticsearch continues to evolve, it has started to embrace the need for a real-time, highly-scalable search library. Not only limiting itself to text searching, Elasticsearch solves the complex problem of geo-spatial searching.
Anyone that has ever been given the responsibility of plotting a database full of markers knows this can be a daunting task. After hours of Googling and trying random SQL statements with the Haversine formula, Elasticsearch is there to put all that to rest. With native support for bounding-box search, Elasticsearch will return only the documents that your viewport is showing. With the new updates to the aggregation framework, Elasticsearch will cluster the markers from the results of the query.
A big reason for using Elasticsearch is the ability to perform full text searching. Not only can one perform a full text search, but also weigh and boost your results. To see the true benefits of boosting a search result, we can use Facebook as an example. The more you search for a friend’s page, the higher in the search results they will appear the next time you search. This is an excellent way to enhance the usability of a site by showing the user only the information they want to see, faster. Not only does Elasticsearch allow you to boost and weigh search results, it will also return a score with each result item. This score will represent how relevant the result is to the search term. With this information, it will be easier to recommend to a user different search terms if the score is consistently low.
If boosting and weighing results are not something you want to handle on your own, Elasticsearch does have a function that will assist in recommending results to the user. The suggest endpoint is what normally will power auto-complete functionality. The suggest feature uses a different type of field mapping, completion, which will run different analyzers on your search query to return the best results. There are various configurations for this field that you can customize to get the best results for your app.
One big downside to using Elasticsearch is the hardware that it needs to run. We have found that with a minimum setup and a little of 1.6M documents indexed, it needs quite a bit of resources to perform a geo query. With this being the only downside, we believe it’s worth the cost to scale servers accordingly.
Our experts are here to help. We live and breathe just about everything going on in the digital world.
Sign up for our newsletter to receive the latest business tips, marketing insight, tech updates and more.