Full Text Search (Postgres) Vs Elastic search

Read Request

In Posgres, full-text indexing allows you to pre-process documents and save the index for later quick searches. Pretreatment includes:

  • Parsing documents into tokens.

  • Convert tokens to tokens.

  • Saving pre-processed documents optimized for search.


tsvector type used in Postgres for full-text search

tsvector type is different from the text type below:

  • Eliminates the case. The uppercase and lowercase letters are identical.

  • Deletes stop words (and, or, not, she, him and hundreds of others), because these words are not related to text search.

  • Replaces synonyms and accepts phrases ( elephanteleph ). In the full text directory, it does not have the word elephant , but the word elep .

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

  • User rating with weights and ts_rank


How does Elastic Search (search engine) take precedence over full-text search in Postgres?

+5
source share
1 answer

Full-text and elasticsearch searches are based on the same underlying inverted index technology, so performance will be roughly the same.

FTS will be easier to deploy.

ES comes with lucene,

if you need lucene with FTS, which will require extra effort.

+3
source

Source: https://habr.com/ru/post/1271223/


All Articles