Reputation: 1255
This is a full text search question. I was using Elasticsearch for my logging system. And now I heard that MongoDB also supports full text search and tested the performance. I made a text index and tested it. With 10,000 words, 10 million documents were created. And it looked up two words. (ex. "apple pineapple") The results were surprising. MongoDB searches were faster.
Am I misunderstanding full text search in Elasticsearch?? did i do the test wrong? In terms of full text search performance, is there no reason why Elasticsearch should be used? Am I misunderstanding full text search?? Please teach me.
Upvotes: 6
Views: 5913
Reputation: 71
if your search use case is just matching simple text like exact terms or phrase matches with basic sorting MongoDB full-text search will work fine. MongoDB supports index time boosting of the fields.
If you need the support of fuzzy search (matching records even with typos in the search query), additional things like search time boosting, complex sorting things based on decay functions, sort builders, etc.. then I would say go with Elastic Search.
source - https://discuss.elastic.co/t/mongodb-full-text-search-vs-elasticsearch/212143/4
Upvotes: 2
Reputation: 713
If your use case is full text search only, I will still be more inclined towards Elasticsearch as it is designed for the same. I admit however that I haven't explored Mongodb capabilities in this regard. Elasticsearch provides various search paths fuzzy, proximity matches, match phrases and more which can be used depending on your use case.
One another difference between Elastic and Mongo's data storage is that Elastic keeps everything in memory while Mongo balances between disk and memory. So ideally Elastic should be faster if you load test it.
In terms of your test, please make sure that both mongo and elastic clusters are of equivalent strength in terms of resources. Else it is not apple to apple comparison.
Upvotes: 4