Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full text search(Postgres) Vs Elastic search

Tags:

Read Query

In Posgres, Full text indexing allows documents to be preprocessed and an index saved for later rapid searching. Preprocessing includes:

  • Parsing documents into tokens.

  • Converting tokens into lexemes.

  • Storing preprocessed documents optimized for searching.


tsvector type is used in Postgres for full text search

tsvector type is different than text type in below aspects:

  • Eliminates case. Upper/lower case letter are identical

  • Removes stop words ( and, or, not, she, him, and hundreds of others)-because these words are not relevant for text search

  • Replaces synonyms and takes word stems (elephant -> eleph). In the full text catalogue, it does not have the word elephant but the word elep.

  • Can (and should) be indexed with GIST and GIN

  • Custom ranking with weights & ts_rank


How Elastic search(search engine) has advantage over full text search in Postgres?

like image 656
overexchange Avatar asked Aug 25 '17 10:08

overexchange


1 Answers

fulltext search and elasticsearch are both built on the same basic technology inverted indices so performance is going to be about the same.

FTS is going to be easier to deploy.

ES comes with lucene,

if you want lucene with FTS that will require extra effort.

like image 197
Jasen Avatar answered Sep 20 '22 08:09

Jasen