# Request on How to change Mapping for all Indices and types at once?

**URL:** <https://discuss.elastic.co/t/request-on-how-to-change-mapping-for-all-indices-and-types-at-once/9356>\
**Category:** Elasticsearch\
**Created:** [October 15, 2012, 9:43am UTC](https://discuss.elastic.co/t/request-on-how-to-change-mapping-for-all-indices-and-types-at-once/9356 "2012-10-15T09:43:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shannu](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shannu](https://discuss.elastic.co/u/shannu)\
**Post date:** [October 15, 2012, 9:43am UTC](https://discuss.elastic.co/t/request-on-how-to-change-mapping-for-all-indices-and-types-at-once/9356/1 "2012-10-15T09:43:41Z")

</div>

Hello All,

I am trying to change the mapping for the below 3 indices/types I have:

## Index/Type

twitter/tweet  
facebook/post  
rss/feeds

I am trying to follow the info given in the link:  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)

$ curl -XPUT '[http://localhost:9200/rss/feeds/\_mapping](http://localhost:9200/rss/feeds/_mapping)' -d '{"feeds" :  
{"properties" : {"\_all" : {"type" : "string", "store" : "yes"}}}}'  
Result : {"ok":true,"acknowledged":true} - (I am able to change the mapping  
for the index rss of type feeds)

but If I want to change all of the indices and types at once and tried:  
$ curl -XPUT '[http://localhost:9200/\_all/\_mapping](http://localhost:9200/_all/_mapping)' -d '{"\_all" :  
{"properties" : {"\_all" : {"type" : "string", "store" : "yes"}}}}'

{"error":"ActionRequestValidationException[Validation Failed: 1: mapping  
type is missing;]","status":500}

curl -XPUT '[http://localhost:9200/\_all/\_mapping](http://localhost:9200/_all/_mapping)' -d '{"TYPE??????" :  
{"properties" : {"\_all" : {"type" : "string", "store" : "yes"}}}}'  
_so How to make this work ? What will be type ??_

\*The reson why I wanted to change the Mapping: \*

I am Using NEST(.NET API)

I am able to index the objects pretty well, but now when I tried to  
serialize the object using Json converter and index the string object(c#  
code excutes fine but... I get the following error in ElasticSearch Server:)  
\*  
Failed to excute [index { so n so..., Source so n so...]  
org.elasticsearch.index.mapper.MapperParsingException: Malformed content,  
must start with an object\*

Any help will be much appreciated.

Regards,  
Shannu.

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 15, 2012, 11:04am UTC](https://discuss.elastic.co/t/request-on-how-to-change-mapping-for-all-indices-and-types-at-once/9356/2 "2012-10-15T11:04:42Z")

</div>

Hi,

I'm not aware of a way to change all your index settings at once. But if  
you want to apply a mapping to all your existing indices, you can use the  
Cluster State API[0] to get a list of indices and loop through them to  
apply your mapping.

If you want to apply the mapping to every new index, you can use index  
templates[1] or config mappings[2].

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

[0]

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

[1]

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

[2] [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/mapping/conf-mappings.html)

On Mon, Oct 15, 2012 at 12:43 PM, shannu [shanmukhaveeranki@gmail.com](mailto:shanmukhaveeranki@gmail.com)wrote:

> Hello All,
> 
> I am trying to change the mapping for the below 3 indices/types I have:
> 
> ## Index/Type
> 
> twitter/tweet  
> facebook/post  
> rss/feeds
> 
> I am trying to follow the info given in the link:  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/**guide/reference/api/admin-)\*\*  
> indices-put-mapping.html[http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)
> 
> $ curl -XPUT '[http://localhost:9200/rss/\*\*feeds/\_mapping](http://localhost:9200/rss/**feeds/_mapping)[http://localhost:9200/rss/feeds/\_mapping](http://localhost:9200/rss/feeds/_mapping)'  
> -d '{"feeds" : {"properties" : {"\_all" : {"type" : "string", "store" :  
> "yes"}}}}'  
> Result : {"ok":true,"acknowledged":\*\*true} - (I am able to change the  
> mapping for the index rss of type feeds)
> 
> but If I want to change all of the indices and types at once and tried:  
> $ curl -XPUT '[http://localhost:9200/\_all/\_\*\*mapping](http://localhost:9200/_all/_**mapping)[http://localhost:9200/\_all/\_mapping](http://localhost:9200/_all/_mapping)'  
> -d '{"\_all" : {"properties" : {"\_all" : {"type" : "string", "store" :  
> "yes"}}}}'
> 
> {"error":" **ActionRequestValidationExcepti** on[Validation Failed: 1:  
> mapping type is missing;]","status":500}
> 
> curl -XPUT '[http://localhost:9200/\_all/\_\*\*mapping](http://localhost:9200/_all/_**mapping)[http://localhost:9200/\_all/\_mapping](http://localhost:9200/_all/_mapping)'  
> -d '{"TYPE??????" : {"properties" : {"\_all" : {"type" : "string", "store" :  
> "yes"}}}}'  
> _so How to make this work ? What will be type ??_
> 
> \*The reson why I wanted to change the Mapping: \*
> 
> I am Using NEST(.NET API)
> 
> I am able to index the objects pretty well, but now when I tried to  
> serialize the object using Json converter and index the string object(c#  
> code excutes fine but... I get the following error in Elasticsearch Server:)  
> \*  
> Failed to excute [index { so n so..., Source so n so...]  
> org.elasticsearch.index.mapper.MapperParsingException: Malformed content,  
> must start with an object\*
> 
> Any help will be much appreciated.
> 
> Regards,  
> Shannu.

--

---

<div class="post-metadata">

**Author:** ![shannu](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shannu](https://discuss.elastic.co/u/shannu)\
**Post date:** [October 15, 2012, 1:08pm UTC](https://discuss.elastic.co/t/request-on-how-to-change-mapping-for-all-indices-and-types-at-once/9356/3 "2012-10-15T13:08:28Z")

</div>

Thanks for the reply Radu.

On Monday, October 15, 2012 12:04:45 PM UTC+1, Radu Gheorghe wrote:

> Hi,
> 
> I'm not aware of a way to change all your index settings at once. But if  
> you want to apply a mapping to all your existing indices, you can use the  
> Cluster State API[0] to get a list of indices and loop through them to  
> apply your mapping.
> 
> If you want to apply the mapping to every new index, you can use index  
> templates[1] or config mappings[2].
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> [0]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-state.html)  
> [1]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)  
> [2]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/conf-mappings.html)
> 
> On Mon, Oct 15, 2012 at 12:43 PM, shannu \<[shanmukh...@gmail.com](mailto:shanmukh...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hello All,
> > 
> > I am trying to change the mapping for the below 3 indices/types I have:
> > 
> > ## Index/Type
> > 
> > twitter/tweet  
> > facebook/post  
> > rss/feeds
> > 
> > I am trying to follow the info given in the link:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/**guide/reference/api/admin-)\*\*  
> > indices-put-mapping.html[http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)
> > 
> > $ curl -XPUT '[http://localhost:9200/rss/\*\*feeds/\_mapping](http://localhost:9200/rss/**feeds/_mapping)[http://localhost:9200/rss/feeds/\_mapping](http://localhost:9200/rss/feeds/_mapping)'  
> > -d '{"feeds" : {"properties" : {"\_all" : {"type" : "string", "store" :  
> > "yes"}}}}'  
> > Result : {"ok":true,"acknowledged":\*\*true} - (I am able to change the  
> > mapping for the index rss of type feeds)
> > 
> > but If I want to change all of the indices and types at once and tried:  
> > $ curl -XPUT '[http://localhost:9200/\_all/\_\*\*mapping](http://localhost:9200/_all/_**mapping)[http://localhost:9200/\_all/\_mapping](http://localhost:9200/_all/_mapping)'  
> > -d '{"\_all" : {"properties" : {"\_all" : {"type" : "string", "store" :  
> > "yes"}}}}'
> > 
> > {"error":" **ActionRequestValidationExcepti** on[Validation Failed: 1:  
> > mapping type is missing;]","status":500}
> > 
> > curl -XPUT '[http://localhost:9200/\_all/\_\*\*mapping](http://localhost:9200/_all/_**mapping)[http://localhost:9200/\_all/\_mapping](http://localhost:9200/_all/_mapping)'  
> > -d '{"TYPE??????" : {"properties" : {"\_all" : {"type" : "string", "store" :  
> > "yes"}}}}'  
> > _so How to make this work ? What will be type ??_
> > 
> > \*The reson why I wanted to change the Mapping: \*
> > 
> > I am Using NEST(.NET API)
> > 
> > I am able to index the objects pretty well, but now when I tried to  
> > serialize the object using Json converter and index the string object(c#  
> > code excutes fine but... I get the following error in Elasticsearch Server:)  
> > \*  
> > Failed to excute [index { so n so..., Source so n so...]  
> > org.elasticsearch.index.mapper.MapperParsingException: Malformed  
> > content, must start with an object\*
> > 
> > Any help will be much appreciated.
> > 
> > Regards,  
> > Shannu.

--

---

<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, 3:08am UTC](https://discuss.elastic.co/t/request-on-how-to-change-mapping-for-all-indices-and-types-at-once/9356/4 "2017-07-06T03:08:47Z")

</div>


