# Inverted Index Creation

**URL:** <https://discuss.elastic.co/t/inverted-index-creation/210194>\
**Category:** Elasticsearch\
**Created:** [December 2, 2019, 2:01pm UTC](https://discuss.elastic.co/t/inverted-index-creation/210194 "2019-12-02T14:01:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harinath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harinath/32/58639_2.png) [@Harinath](https://discuss.elastic.co/u/Harinath)\
**Post date:** [December 2, 2019, 2:01pm UTC](https://discuss.elastic.co/t/inverted-index-creation/210194/1 "2019-12-02T14:01:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 2, 2019, 3:02pm UTC](https://discuss.elastic.co/t/inverted-index-creation/210194/2 "2019-12-02T15:02:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Harinath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harinath/32/58639_2.png) [@Harinath](https://discuss.elastic.co/u/Harinath)\
**Post date:** [December 3, 2019, 4:34am UTC](https://discuss.elastic.co/t/inverted-index-creation/210194/3 "2019-12-03T04:34:45Z")

</div>

Thanks @spinscale

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 31, 2019, 4:35am UTC](https://discuss.elastic.co/t/inverted-index-creation/210194/4 "2019-12-31T04:35:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
