Inverted Index Creation

It might be a dumb question. Please excuse me.

I understand from the documentation that for every document created in elasticsearch (ES), ES creates an index using TF-IDF or BM25 algorithm.

  1. Will inverted index will be created only for the text data type field or all data type. If inverted text created only for text data type how other fields are stored internally in ES?

Thanks

hey,

so, the algorithms you mentioned are used for scoring, meaning the decision how relevant a document is compared to a query.

Apache Lucene (the underlying full text search library) has a couple of different data structures, that it uses internally to store different datatypes. Text is stored in an inverted index, range datatypes, number or geoshapes are stored in a block KD tree for example. By configuring the mapping of an Elasticsearch index, Elasticsearch internally decides what data structure to use for which field.

Hope this helps!

--Alex

1 Like

Thanks @spinscale