# Elasticsearch reindex then cant add mapping

**URL:** <https://discuss.elastic.co/t/elasticsearch-reindex-then-cant-add-mapping/278345>\
**Category:** Elasticsearch\
**Tags:** reindex\
**Created:** [July 10, 2021, 10:31pm UTC](https://discuss.elastic.co/t/elasticsearch-reindex-then-cant-add-mapping/278345 "2021-07-10T22:31:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordanuseselastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jordanuseselastic/32/77625_2.png) [@jordanuseselastic](https://discuss.elastic.co/u/jordanuseselastic)\
**Post date:** [July 10, 2021, 10:31pm UTC](https://discuss.elastic.co/t/elasticsearch-reindex-then-cant-add-mapping/278345/1 "2021-07-10T22:31:16Z")

</div>

Hi Elasticsearch experts! Wondering if someone can help with a strange thing that is happening: We have an index in which the amount of mappings has grown massive (over 3000) and we want to reduce this by reindexing. In the new index we will have dynamic mappings turned off and only add the mappings which we will want to use to search. So, I created an new index:

```auto
PUT /newindex-2021.01/_mapping
{
  "dynamic": "false",
  "date_detection": true,
  "properties": {
    "timestamp": {
      "type": "date"
    }
  }
}

```

Then I reindexed:

```auto
POST _reindex?wait_for_completion=false
{
  "source": {
    "index": "oldindex-2021.01"
  },
  "dest": {
    "index": "newindex-2021.01"
  }
}

```

Then I wanted to add an mapping for the event field to test that everything is working so I ran:

```auto
PUT /*newindex*/_mapping
{
  "properties": {
    "event": {
      "type": "text"
    }
  }
}

```

and to be safe, i also ran (not sure if this had any effect):

```auto
PUT /newindex-2021.0/_mapping
{
  "properties": {
    "event": {
      "type": "text"
    }
  }
}

```

When I navigate to the discover page, it now shows the magnifying glass for the event field (signalling that I can search for just event as a mapping had been created). However, when i click it, no results show (as if there are no documents which have the field event == the value despite it definitely existing) Is there something that I am missing? I simply want to add a mapping to an empty index.. Thanks for your help!

---

<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:** [July 12, 2021, 8:16am UTC](https://discuss.elastic.co/t/elasticsearch-reindex-then-cant-add-mapping/278345/2 "2021-07-12T08:16:50Z")

</div>

Important note: Adding a new field via the put mapping API does **NOT** change your data. So in order to index that field, you need to reindex (or run an update by query on that index in order to reindex all documents within that index).

I suppose that this is the issue here, but so far this is just an educated guess 🙂

---

<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:** [August 9, 2021, 8:17am UTC](https://discuss.elastic.co/t/elasticsearch-reindex-then-cant-add-mapping/278345/3 "2021-08-09T08:17:33Z")

</div>

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