# Possible to modity mapping after its creation, by disable search on a property?

**URL:** https://discuss.elastic.co/t/possible-to-modity-mapping-after-its-creation-by-disable-search-on-a-property/20107
**Category:** Elasticsearch
**Created:** [October 7, 2014, 9:19am UTC](https://discuss.elastic.co/t/possible-to-modity-mapping-after-its-creation-by-disable-search-on-a-property/20107 "2014-10-07T09:19:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jac](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Jac](https://discuss.elastic.co/u/Jac)
#### Post date: [October 7, 2014, 9:19am UTC](https://discuss.elastic.co/t/possible-to-modity-mapping-after-its-creation-by-disable-search-on-a-property/20107/1 "2014-10-07T09:19:35Z")

</div>

Hello everyone,

A problem that I'm trying to handler now it's how to update an existing  
mapping after its creation (not adding new fields, but more like to  
delete/modify existing ones).  
Apparently, read from lots of existing posts, it's not possible unless we  
reindex the whole data again.

Since we have the possibility of setting "index":"no" to a property during  
the creation of a mapping, so that this property won't be searchable.  
So I tested the following scripts.

I created a mapping for a type :  
PUT test/mytype/\_mapping  
{  
"mytype" : {  
"properties" : {  
"id": {"type" : "string"},  
"name": {"type" : "string"},  
"age": {"type" : "integer"},  
"message" : {"type" : "string"}  
}  
}  
}

Then I closed the index, and try to modify the mapping by the following  
script  
PUT test/mytype/\_mapping?ignore\_conflicts=true  
{  
"mytype" : {  
"properties" : {  
"id": {"type" : "string"},  
"name": {"type" : "string"},  
"age": {"type" : "integer"},  
"message" : {"type" : "string","index": "no"}  
}  
}  
}

Since I choose the option to ignore\_conflicts=true, no exception is  
returned, but in the same time, nothing happened neither on the mapping.

My question is :  
Is there any solution, without reindex the whole data, to disable the  
search on some existing properties after creation and insertion of a type?

Thank you very much.

Jac

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 7, 2014, 9:22am UTC](https://discuss.elastic.co/t/possible-to-modity-mapping-after-its-creation-by-disable-search-on-a-property/20107/2 "2014-10-07T09:22:34Z")

</div>

You need to either create a new field (and reindex) or remove the type or better remove the index.  
But reindex.

You can use aliases if you want to do that without downtime. I mean create a new index with new mapping. Reindex. Then switch the alias. Drop the old index.

You can also read elasticsearch if you kept the \_source field using some scripts and scan and scroll API.

HTH

--  
David Pilato | Technical Advocate | [elasticsearch.com](http://elasticsearch.com)  
[david.pilato@elasticsearch.com](mailto:david.pilato@elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 7 octobre 2014 à 11:19:38, Yuan LIN ([linyuan1021@gmail.com](mailto:linyuan1021@gmail.com)) a écrit:

Hello everyone,

A problem that I'm trying to handler now it's how to update an existing mapping after its creation (not adding new fields, but more like to delete/modify existing ones).  
Apparently, read from lots of existing posts, it's not possible unless we reindex the whole data again.

Since we have the possibility of setting "index":"no" to a property during the creation of a mapping, so that this property won't be searchable.  
So I tested the following scripts.

I created a mapping for a type :  
PUT test/mytype/\_mapping  
{  
"mytype" : {  
"properties" : {  
"id": {"type" : "string"},  
"name": {"type" : "string"},  
"age": {"type" : "integer"},  
"message" : {"type" : "string"}  
}  
}  
}

Then I closed the index, and try to modify the mapping by the following script  
PUT test/mytype/\_mapping?ignore\_conflicts=true  
{  
"mytype" : {  
"properties" : {  
"id": {"type" : "string"},  
"name": {"type" : "string"},  
"age": {"type" : "integer"},  
"message" : {"type" : "string","index": "no"}  
}  
}  
}

Since I choose the option to ignore\_conflicts=true, no exception is returned, but in the same time, nothing happened neither on the mapping.

My question is :  
Is there any solution, without reindex the whole data, to disable the search on some existing properties after creation and insertion of a type?

Thank you very much.

## Jac

You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.5433b0da.8138641.7bd4%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5433b0da.8138641.7bd4%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Jac](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Jac](https://discuss.elastic.co/u/Jac)
#### Post date: [October 7, 2014, 12:01pm UTC](https://discuss.elastic.co/t/possible-to-modity-mapping-after-its-creation-by-disable-search-on-a-property/20107/3 "2014-10-07T12:01:19Z")

</div>

Thank you very much.

在 2014年10月7日星期二UTC+2上午11时23分13秒，David Pilato写道：

> You need to either create a new field (and reindex) or remove the type or  
> better remove the index.  
> But reindex.
> 
> You can use aliases if you want to do that without downtime. I mean create  
> a new index with new mapping. Reindex. Then switch the alias. Drop the old  
> index.
> 
> You can also read elasticsearch if you kept the \_source field using some  
> scripts and scan and scroll API.
> 
> HTH
> 
> --  
> _David Pilato_ | Technical Advocate | _[elasticsearch.com](http://elasticsearch.com)  
> [http://elasticsearch.com](http://elasticsearch.com)_  
> [david....@elasticsearch.com](mailto:david....@elasticsearch.com) \<javascript:\>  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs  
> [http://twitter.com/scrutmydocs](http://twitter.com/scrutmydocs)  
> [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 7 octobre 2014 à 11:19:38, Yuan LIN ([linyu...@gmail.com](mailto:linyu...@gmail.com) \<javascript:\>)  
> a écrit:
> 
> Hello everyone,
> 
> A problem that I'm trying to handler now it's how to update an existing  
> mapping after its creation (not adding new fields, but more like to  
> delete/modify existing ones).  
> Apparently, read from lots of existing posts, it's not possible unless we  
> reindex the whole data again.
> 
> Since we have the possibility of setting "index":"no" to a property during  
> the creation of a mapping, so that this property won't be searchable.  
> So I tested the following scripts.
> 
> I created a mapping for a type :  
> PUT test/mytype/\_mapping  
> {  
> "mytype" : {  
> "properties" : {  
> "id": {"type" : "string"},  
> "name": {"type" : "string"},  
> "age": {"type" : "integer"},  
> "message" : {"type" : "string"}  
> }  
> }  
> }
> 
> Then I closed the index, and try to modify the mapping by the following  
> script  
> PUT test/mytype/\_mapping?ignore\_conflicts=true  
> {  
> "mytype" : {  
> "properties" : {  
> "id": {"type" : "string"},  
> "name": {"type" : "string"},  
> "age": {"type" : "integer"},  
> "message" : {"type" : "string","index": "no"}  
> }  
> }  
> }
> 
> Since I choose the option to ignore\_conflicts=true, no exception is  
> returned, but in the same time, nothing happened neither on the mapping.
> 
> My question is :  
> Is there any solution, without reindex the whole data, to disable the  
> search on some existing properties after creation and insertion of a type?
> 
> Thank you very much.
> 
> ## Jac
> 
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a0be22b9-ea77-4801-8251-94ca53389e90%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/82f5f7c5-6596-47de-b16e-3019e545008a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/82f5f7c5-6596-47de-b16e-3019e545008a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:57am UTC](https://discuss.elastic.co/t/possible-to-modity-mapping-after-its-creation-by-disable-search-on-a-property/20107/4 "2017-07-06T00:57:54Z")

</div>


