Question

I am building a web application in ASP.NET 4.5 C#. My app will be heavily relied on searching capabilities. I am searching for a high-performing searching solution for my project. I am looking at one that is efficient / fast and easy to implement.

After going over a few solution, I found ElasticSearch to offer excellent searching capabilities, as well it's supported by Amazon Web Services if I decide to deploy my project there.

However, I've read that MySQL 5.6 now features Full Text Search foor InnoDB tables. I wanted to know the difference, cons and pros of each approach in order to decide which one to use in my next project.

My main goal: being able to make very fast searches against my database and enjoy the benefits of natural language search, scoring, etc. I will actually have very small text fields of 100 characters for my searchable text fields.

Summary of my questions:

  1. What is the foundemental differences between MySQL 5.6 Full Text Search and ElasticSearch? (advantages and disadvantages)
  2. With MySQL Full Text Search, do I need to separate the searching index / functionality from the database (for example, with ElasticSearch I am using the ELasticSearch server which I can deploy on a different server. I wonder if that works the same with MySQL Full Text Search too?
  3. Which one is easier to implement?
  4. Is there any advantages of using either in ASP.NET project (like supported client libraries, etc.)

Thanks.

Was it helpful?

Solution

I'm not very familiar with MySQL 5.6 Full Text Search capabilities, but I'm using ElasticSearch in my ASP.NET Web App.

  1. MySQL is queried in SQL, ES is queried in JSON, as it is RESTful

  2. While MySQL is database management system itself, ElasticSearch is only a search engine. The data on which search is performed is stored in it's index (ElasticSearch data store is called index). This index sometimes likes to fail, and then you need to have your data backuped in some external database (I'm using NoSQL solution - MongoDB, as I struggle with BigData problem), from which you restore it.

  3. ElasticSearch is distributed system. It uses Shards - when you perform search, the index is splitted into number of shards, which are searched independently by separate threads. Then search results are consolidated into one set. As scoring is calculated in some way based on number of records on which search is performed, it may be different for the same record depending on which shard it was and how many records were assigned to this shard (although it is configurable in search query options - see DFSThenFetch)

  4. ES can be interacted with from C# code by using by NEST library, which allows you to map ES entities into C# classes and query them by LINQ, by lambda syntax (utilizing expressions more than predicates)

  5. Querying ElasticSearch can be pretty challenging if your entities have many fields. In my case I had to implement a pretty complex Query builder, as there is very many ways of performing searching query on ElasticSearch - see http://www.elasticsearch.org/guide/reference/query-dsl/ (all those query types are implemented in NEST library). You query pretty differently for matching string, than filtering data, eg. GreaterThan or LessOEqual.

  6. ES allows you to utilize fuzzy matching based on Levenshtein Distance, which is p retty nice when struggling with typos.

  7. ElasticSearch is very, very fast. Where MS SQL Server searched my data (by simple query) for more than 1 minute, ES is doing it in less than 20 ms (even by using very complex query). It is distributed implementation of Lucene search engine.

I know my post is not straight answer to your questions, but I hope it provides you some info concerning ElasticSearch, and helps you in any way. Cheers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top