# Reindex after mapping

**URL:** <https://discuss.elastic.co/t/reindex-after-mapping/32669>\
**Category:** Elasticsearch\
**Created:** [October 21, 2015, 12:07pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669 "2015-10-21T12:07:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)\
**Post date:** [October 21, 2015, 12:07pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/1 "2015-10-21T12:07:28Z")

</div>

When i do mapping for field then i need do reindex?

```
PUT /contact
{
      "properties": {
         "perms": {
            "type": "multi_field",
            "fields": {
                "perms": {"type": "string"},
                "original": {"type" : "string", "index" : "not_analyzed"}
            }
         }
      }
   }
}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 21, 2015, 12:20pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/2 "2015-10-21T12:20:01Z")

</div>

Yes if you want to be able to search using the new field, then you need to reindex.

---

<div class="post-metadata">

**Author:** ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)\
**Post date:** [October 22, 2015, 10:56am UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/3 "2015-10-22T10:56:39Z")

</div>

> [@dadoonet](#):
>
> Yes if you want to be able to search using the new field, then you need to reindex.

May be has ready command for this, or I must make request to elasticsearch for add index?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 22, 2015, 11:08am UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/4 "2015-10-22T11:08:03Z")

</div>

There is no reindex command.

---

<div class="post-metadata">

**Author:** ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)\
**Post date:** [October 22, 2015, 12:14pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/5 "2015-10-22T12:14:40Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 22, 2015, 1:19pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/6 "2015-10-22T13:19:19Z")

</div>

Elasticsearch clients typically offer this e.g. the python one [1]  
Note also that the use of aliases [2] eases the transition from one index version to another with no downtime for your users

[1] [http://elasticsearch-py.readthedocs.org/en/master/helpers.html#reindex](http://elasticsearch-py.readthedocs.org/en/master/helpers.html#reindex)  
[2] [https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html)

---

<div class="post-metadata">

**Author:** ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)\
**Post date:** [October 22, 2015, 2:38pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/7 "2015-10-22T14:38:49Z")

</div>

If i use alias for example PUT /portal\_v1/\_alias/portal

when i search by portal, elasticsearch will be use my alias portal\_v1?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 22, 2015, 2:43pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/8 "2015-10-22T14:43:34Z")

</div>

Right - aliases are an incredibly useful level of indirection an elasticsearch cluster administrator can use to reroute client requests in lots of interesting ways (managing new index versions, querying multiple time-based indexes, filtering index contents for different users....)

---

<div class="post-metadata">

**Author:** ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)\
**Post date:** [October 22, 2015, 2:45pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/9 "2015-10-22T14:45:33Z")

</div>

in my application i must set type as alias?

```
$params = [
            'index' => 'portal_v1', // or portal
            'type' => 'contact',
            'size' => 200
        ];
```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 22, 2015, 2:47pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/10 "2015-10-22T14:47:30Z")

</div>

You use the alias name "portal".  
From a user's perspective an alias is the same as a concrete index but gives the cluster administrator the option of switching how it is mapped e.g. to portal\_v1 or portal\_v2 with no client downtime.

---

<div class="post-metadata">

**Author:** ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)\
**Post date:** [October 22, 2015, 2:49pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/11 "2015-10-22T14:49:54Z")

</div>

when i make new mapping for portal\_v2 then i must change all scripts like

```
$params = [
            'index' => 'portal_v2', 
            'type' => 'contact',
            'size' => 200
        ];
```

---

<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:** [July 5, 2017, 11:43pm UTC](https://discuss.elastic.co/t/reindex-after-mapping/32669/12 "2017-07-05T23:43:13Z")

</div>


