# Reindexing drops the field datatypes

**URL:** <https://discuss.elastic.co/t/reindexing-drops-the-field-datatypes/169241>\
**Category:** Elasticsearch\
**Created:** [February 20, 2019, 3:27pm UTC](https://discuss.elastic.co/t/reindexing-drops-the-field-datatypes/169241 "2019-02-20T15:27:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Praneet\_Khandelwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praneet_khandelwal/32/40565_2.png) [@Praneet\_Khandelwal](https://discuss.elastic.co/u/Praneet_Khandelwal)\
**Post date:** [February 20, 2019, 3:27pm UTC](https://discuss.elastic.co/t/reindexing-drops-the-field-datatypes/169241/1 "2019-02-20T15:27:53Z")

</div>

I am trying to reindex data in elasticsearch. In our case, there are a lot of indexed fields (~6000) and because all of them are indexed, ES has already determined the datatypes for quite a few of them.  
In the new indices I am creating, I have defined a mapping which specifies only the fields that we would require to be indexed(~30); but we would require aggregation on other fields (which are not indexed).  
So the issue I am facing is that ES drops the datatypes for the fields that are not indexed. Is there a way I can reindex with retaining the datatype mapping but indexing only the fields I want.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [February 20, 2019, 3:41pm UTC](https://discuss.elastic.co/t/reindexing-drops-the-field-datatypes/169241/2 "2019-02-20T15:41:14Z")

</div>

If you don't map the field then Elasticsearch won't build any data structures for it. Unless automatic mapping is turned on, then it'll map it for you. Anyway. I think what you are looking for is the `"index": false` option documented [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html). You'll want to make sure you get doc values for the fields you want to aggregate on so you should map them with `"index": false`.

---

<div class="post-metadata">

**Author:** ![Praneet\_Khandelwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praneet_khandelwal/32/40565_2.png) [@Praneet\_Khandelwal](https://discuss.elastic.co/u/Praneet_Khandelwal)\
**Post date:** [February 20, 2019, 6:51pm UTC](https://discuss.elastic.co/t/reindexing-drops-the-field-datatypes/169241/3 "2019-02-20T18:51:03Z")

</div>

Thanks for the reply.But to use the index option I would have to write a mapping which includes all the fields and specify "index" : false in the fields which I do not want to be indexed.

---

<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:** [March 20, 2019, 6:51pm UTC](https://discuss.elastic.co/t/reindexing-drops-the-field-datatypes/169241/4 "2019-03-20T18:51:10Z")

</div>

Closed on March 20, 2019, 6:51pm UTC

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