# Changing default mapping

**URL:** <https://discuss.elastic.co/t/changing-default-mapping/4202>\
**Category:** Elasticsearch\
**Created:** [April 7, 2011, 10:42pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202 "2011-04-07T22:42:53Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel\_Benavides](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Manuel\_Benavides](https://discuss.elastic.co/u/Manuel_Benavides)\
**Post date:** [April 7, 2011, 10:42pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/1 "2011-04-07T22:42:53Z")

</div>

I have the following default mapping:

{"company" : {"item" : {"properties" : {  
"model" : {"type" : "string"},  
"itemID" : {"type" : "string"},  
"listingDate" : {"format" : "dateOptionalTime", "type" :  
"date"},  
"condition" : {"type" : "string"},  
"type" : {"type" : "string"},  
"mainImage" : {"type" : "string"},  
"percOff" : {"type" : "string"},  
"size" : {"type" : "string"},  
"username" : {"type" : "string"},  
"category" : {"type" : "string"},  
"title" : {"type" : "string"},  
"price" : {"type" : "string"},  
"msrp" : { "type" : "string"},  
"description" : { "type" : "string"},  
"brand" : { "type" : "string"}}}}}

Then I go and change some values and I'll need to sort them and run  
queries with ranges on some of them with the following command:

curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
{"geartrade":{"item":{"properties":{  
"model":{"type":"string"},  
"itemID":{"type":"integer"},  
"listingDate":{"format":"dateOptionalTime","type":"date"},  
"condition":{"type":"string"},  
"type":{"type":"string"},  
"mainImage":{"type":"string"},  
"percOff":{"type":"float"},  
"size":{"type":"string"},  
"username":{"type":"string"},  
"category":{"type":"string"},  
"title":{"type":"string"},  
"price":{"type":"float"},  
"msrp":{"type":"float"},  
"description":{"type":"string"},  
"brand":{"type":"string"}}}}}'

and then when I run to command I get this message  
{"ok":true,"acknowledged":true}

But then I go and run again the get mapping command and I get the  
mapping unchanged

I tried updating then mapping and then refreshing, even changing the  
mapping and stopping elastic search with no luck, any idea of why the  
mapping does not change?

thanks a lot,

---

<div class="post-metadata">

**Author:** ![AGuereca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aguereca/32/2357_2.png) [@AGuereca](https://discuss.elastic.co/u/AGuereca)\
**Post date:** [April 7, 2011, 10:55pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/2 "2011-04-07T22:55:35Z")

</div>

Hi Manuel,

Mapping is recommended to be defined at the time you are actually creating the index.  
Once the index is created either explicitly or because you insert a document (and a default mapping is created for you), very few settings are available of change.

I'll suggest reviewing:  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html)  
And  
[http://www.elasticsearch.org/guide/reference/mapping/](http://www.elasticsearch.org/guide/reference/mapping/)

~AG

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [April 8, 2011, 7:57am UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/3 "2011-04-08T07:57:11Z")

</div>

On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:

> I have the following default mapping:
> 
> {"company" : {"item" : {"properties" : {  
> "model" : {"type" : "string"},  
> "itemID" : {"type" : "string"},  
> ... trimmed ...  
> "description" : { "type" : "string"},  
> "brand" : { "type" : "string"}}}}}
> 
> Then I go and change some values and I'll need to sort them and run  
> queries with ranges on some of them with the following command:
> 
> curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> {"geartrade":{"item":{"properties":{  
> "model":{"type":"string"},

Where does "geartrade" come from?

Your mapping syntax is wrong.

Also, you can only update a mapping if it doesn't conflict with the  
existing mapping. Otherwise, you need to create a new type with the new  
mapping (perhaps in a new index), and reindex your data with the new  
mapping.

clint

---

<div class="post-metadata">

**Author:** ![Barsk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/barsk/32/13734_2.png) [@Barsk](https://discuss.elastic.co/u/Barsk)\
**Post date:** [April 8, 2011, 9:34am UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/4 "2011-04-08T09:34:20Z")

</div>

I see a lot of references to "reindexing" the index in the mailing list.  
But I am a bit unsure of what that really means.  
For instance when you change the mappings for a type reindexing is  
needed. How do I do that?

Is there an API method to call?  
Do I have to delete all contents and store again?  
Is reindexing the same as refresh? If not what is really refresh then?

Well, a bit of a newbie questions, but I am sure easy to answer for  
anyone who knows...

---

<div class="post-metadata">

**Author:** ![dpilato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpilato/32/2449_2.png) [@dpilato](https://discuss.elastic.co/u/dpilato)\
**Post date:** [April 8, 2011, 1:05pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/5 "2011-04-08T13:05:02Z")

</div>

I think you have only to push again all your documents to elastic search.

Elastic will update the mapping (or will use the new mapping if you have  
provided it to ES just before) and will update each document. So you don't  
have to delete anything.

Hope this helps,  
David

-----Message d'origine-----  
De : Kristian Jörg [[mailto:krjg@devo.se](mailto:krjg@devo.se)]  
Envoyé : vendredi 8 avril 2011 11:34  
À : [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Objet : Reindex & refresh?

I see a lot of references to "reindexing" the index in the mailing list.  
But I am a bit unsure of what that really means.  
For instance when you change the mappings for a type reindexing is needed.  
How do I do that?

Is there an API method to call?  
Do I have to delete all contents and store again?  
Is reindexing the same as refresh? If not what is really refresh then?

Well, a bit of a newbie questions, but I am sure easy to answer for anyone  
who knows...

---

<div class="post-metadata">

**Author:** ![Manuel\_Benavides](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Manuel\_Benavides](https://discuss.elastic.co/u/Manuel_Benavides)\
**Post date:** [April 8, 2011, 2:13pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/6 "2011-04-08T14:13:05Z")

</div>

geartrade just the name of the index I changed it on the other places for  
testing and forgot that one on the console I am running it OK so the syntax  
is not wrong, I think then it just shouldn't say that the mapping was  
updated successfully as it does, I'll give it a try with a newly fresh  
index.

On Fri, Apr 8, 2011 at 1:57 AM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:
> 
> > I have the following default mapping:
> > 
> > {"company" : {"item" : {"properties" : {  
> > "model" : {"type" : "string"},  
> > "itemID" : {"type" : "string"},  
> > ... trimmed ...  
> > "description" : { "type" : "string"},  
> > "brand" : { "type" : "string"}}}}}
> > 
> > Then I go and change some values and I'll need to sort them and run  
> > queries with ranges on some of them with the following command:
> > 
> > curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> > {"geartrade":{"item":{"properties":{  
> > "model":{"type":"string"},
> 
> Where does "geartrade" come from?
> 
> Your mapping syntax is wrong.
> 
> Also, you can only update a mapping if it doesn't conflict with the  
> existing mapping. Otherwise, you need to create a new type with the new  
> mapping (perhaps in a new index), and reindex your data with the new  
> mapping.
> 
> clint

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 8, 2011, 6:23pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/7 "2011-04-08T18:23:51Z")

</div>

Hey,

Reindexing means just that, go over what you have indexed up until now and index it back. In terms of managing indices with elasticsearch, it is recommended to reindex into a fresh index the data (possibly using updated mappings), and then hot swap it using aliases.

Getting the data to reindex can be done either by going to your where your master data is stored, and index it again (for example, from the database), or, get it from elasticsearch. Getting it from elasticsearch in an efficient manner will be possible in the upcoming version using the scan search type (already in master).

Refresh is the process of making changes done (indexing for example) visible to search. It is not related to indexing.

-shay.banon  
On Friday, April 8, 2011 at 4:05 PM, David Pilato wrote:

> I think you have only to push again all your documents to Elasticsearch.
> 
> Elastic will update the mapping (or will use the new mapping if you have  
> provided it to ES just before) and will update each document. So you don't  
> have to delete anything.
> 
> Hope this helps,  
> David
> 
> -----Message d'origine-----  
> De : Kristian JÃ¶rg [[mailto:krjg@devo.se](mailto:krjg@devo.se)]  
> EnvoyÃ© : vendredi 8 avril 2011 11:34  
> Ã : [users@elasticsearch.com](mailto:users@elasticsearch.com)  
> Objet : Reindex & refresh?
> 
> I see a lot of references to "reindexing" the index in the mailing list.  
> But I am a bit unsure of what that really means.  
> For instance when you change the mappings for a type reindexing is needed.  
> How do I do that?
> 
> Is there an API method to call?  
> Do I have to delete all contents and store again?  
> Is reindexing the same as refresh? If not what is really refresh then?
> 
> Well, a bit of a newbie questions, but I am sure easy to answer for anyone  
> who knows...

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 8, 2011, 6:27pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/8 "2011-04-08T18:27:37Z")

</div>

Can you provide a curl recreation? [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help).  
On Friday, April 8, 2011 at 5:13 PM, Manuel Antonio Benavides Salazar wrote:

> geartrade just the name of the index I changed it on the other places for testing and forgot that one on the console I am running it OK so the syntax is not wrong, I think then it just shouldn't say that the mapping was updated successfully as it does, I'll give it a try with a newly fresh index.
> 
> On Fri, Apr 8, 2011 at 1:57 AM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:
> 
> > On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:
> > 
> > > I have the following default mapping:
> > > 
> > > {"company" : {"item" : {"properties" : {  
> > > "model" : {"type" : "string"},  
> > > "itemID" : {"type" : "string"},  
> > > ... trimmed ...  
> > > "description" : { "type" : "string"},  
> > > "brand" : { "type" : "string"}}}}}
> > > 
> > > Then I go and change some values and I'll need to sort them and run  
> > > queries with ranges on some of them with the following command:
> > > 
> > > curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> > > {"geartrade":{"item":{"properties":{  
> > > "model":{"type":"string"},
> > 
> > Where does "geartrade" come from?
> > 
> > Your mapping syntax is wrong.
> > 
> > Also, you can only update a mapping if it doesn't conflict with the  
> > existing mapping. Otherwise, you need to create a new type with the new  
> > mapping (perhaps in a new index), and reindex your data with the new  
> > mapping.
> > 
> > clint

---

<div class="post-metadata">

**Author:** ![Manuel\_Benavides](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Manuel\_Benavides](https://discuss.elastic.co/u/Manuel_Benavides)\
**Post date:** [April 8, 2011, 8:37pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/9 "2011-04-08T20:37:21Z")

</div>

Sure this is what I run:

curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
{"company":{  
"item":{"  
properties":{  
"model":{"type":"string"},  
"itemID":{"type":"integer"},  
"listingDate":{"format":"dateOptionalTime","type":"date"},  
"condition":{"type":"string"},  
"type":{"type":"string"},  
"mainImage":{"type":"string"},  
"percOff":{"type":"float"},  
"size":{"type":"string"},  
"username":{"type":"string"},  
"category":{"type":"string"},  
"title":{"type":"string"},  
"price":{"type":"float"},  
"msrp":{"type":"float"},  
"description":{"type":"string"},  
"brand":{"type":"string"}  
}  
}  
}}'

And when I do I get back:

{"ok":true,"acknowledged":true}

I tried with a fresh index with nothing indexed and still don't work, I just  
read that you can send a mapping when you create the index so I'll try that  
right now.

thanks,

On Fri, Apr 8, 2011 at 12:27 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Can you provide a curl recreation? [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help).
> 
> On Friday, April 8, 2011 at 5:13 PM, Manuel Antonio Benavides Salazar  
> wrote:
> 
> geartrade just the name of the index I changed it on the other places for  
> testing and forgot that one on the console I am running it OK so the syntax  
> is not wrong, I think then it just shouldn't say that the mapping was  
> updated successfully as it does, I'll give it a try with a newly fresh  
> index.
> 
> On Fri, Apr 8, 2011 at 1:57 AM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:
> 
> On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:
> 
> > I have the following default mapping:
> > 
> > {"company" : {"item" : {"properties" : {  
> > "model" : {"type" : "string"},  
> > "itemID" : {"type" : "string"},  
> > ... trimmed ...  
> > "description" : { "type" : "string"},  
> > "brand" : { "type" : "string"}}}}}
> > 
> > Then I go and change some values and I'll need to sort them and run  
> > queries with ranges on some of them with the following command:
> > 
> > curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> > {"geartrade":{"item":{"properties":{  
> > "model":{"type":"string"},
> 
> Where does "geartrade" come from?
> 
> Your mapping syntax is wrong.
> 
> Also, you can only update a mapping if it doesn't conflict with the  
> existing mapping. Otherwise, you need to create a new type with the new  
> mapping (perhaps in a new index), and reindex your data with the new  
> mapping.
> 
> clint

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 8, 2011, 8:52pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/10 "2011-04-08T20:52:41Z")

</div>

Its because the top level field is the index name, which it shouldn't be. The top level field should be just the type name, without the index name. I understand (I think) where the confusion is coming from, because of the GET Mapping API response when asking for a specific type mapping in a single index, thats why I added this to master:

[Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/closed#issue/838).

On Friday, April 8, 2011 at 11:37 PM, Manuel Antonio Benavides Salazar wrote:

> Sure this is what I run:
> 
> curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> {"company":{  
> "item":{"  
> properties":{  
> "model":{"type":"string"},  
> "itemID":{"type":"integer"},  
> "listingDate":{"format":"dateOptionalTime","type":"date"},  
> "condition":{"type":"string"},  
> "type":{"type":"string"},  
> "mainImage":{"type":"string"},  
> "percOff":{"type":"float"},  
> "size":{"type":"string"},  
> "username":{"type":"string"},  
> "category":{"type":"string"},  
> "title":{"type":"string"},  
> "price":{"type":"float"},  
> "msrp":{"type":"float"},  
> "description":{"type":"string"},  
> "brand":{"type":"string"}  
> }  
> }  
> }}'
> 
> And when I do I get back:
> 
> {"ok":true,"acknowledged":true}
> 
> I tried with a fresh index with nothing indexed and still don't work, I just read that you can send a mapping when you create the index so I'll try that right now.
> 
> thanks,
> 
> On Fri, Apr 8, 2011 at 12:27 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Can you provide a curl recreation? [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help).  
> > On Friday, April 8, 2011 at 5:13 PM, Manuel Antonio Benavides Salazar wrote:
> > 
> > > geartrade just the name of the index I changed it on the other places for testing and forgot that one on the console I am running it OK so the syntax is not wrong, I think then it just shouldn't say that the mapping was updated successfully as it does, I'll give it a try with a newly fresh index.
> > > 
> > > On Fri, Apr 8, 2011 at 1:57 AM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:
> > > 
> > > > On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:
> > > > 
> > > > > I have the following default mapping:
> > > > > 
> > > > > {"company" : {"item" : {"properties" : {  
> > > > > "model" : {"type" : "string"},  
> > > > > "itemID" : {"type" : "string"},  
> > > > > ... trimmed ...  
> > > > > "description" : { "type" : "string"},  
> > > > > "brand" : { "type" : "string"}}}}}
> > > > > 
> > > > > Then I go and change some values and I'll need to sort them and run  
> > > > > queries with ranges on some of them with the following command:
> > > > > 
> > > > > curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> > > > > {"geartrade":{"item":{"properties":{  
> > > > > "model":{"type":"string"},
> > > > 
> > > > Where does "geartrade" come from?
> > > > 
> > > > Your mapping syntax is wrong.
> > > > 
> > > > Also, you can only update a mapping if it doesn't conflict with the  
> > > > existing mapping. Otherwise, you need to create a new type with the new  
> > > > mapping (perhaps in a new index), and reindex your data with the new  
> > > > mapping.
> > > > 
> > > > clint

---

<div class="post-metadata">

**Author:** ![Manuel\_Benavides](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Manuel\_Benavides](https://discuss.elastic.co/u/Manuel_Benavides)\
**Post date:** [April 8, 2011, 9:02pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/11 "2011-04-08T21:02:30Z")

</div>

Great just tried it like this and totally worked, yeah is a bit confusing  
but really makes sense thanks a ton.

curl -XPUT '[http://localhost:9200/geartrade/\_mapping](http://localhost:9200/geartrade/_mapping)' -d  
'{"item":{"properties":{"model":{"type":"string"},"itemID":{"type":"integer"},"listingDate":{"format":"dateOptionalTime","type":"date"},"condition":{"type":"string"},"type":{"type":"string"},"mainImage":{"type":"string"},"percOff":{"type":"float"},"size":{"type":"string"},"username":{"type":"string"},"category":{"type":"string"},"title":{"type":"string"},"price":{"type":"float"},"msrp":{"type":"float"},"description":{"type":"string"},"brand":{"type":"string"}}}}'

On Fri, Apr 8, 2011 at 2:52 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Its because the top level field is the index name, which it shouldn't be.  
> The top level field should be just the type name, without the index name. I  
> understand (I think) where the confusion is coming from, because of the GET  
> Mapping API response when asking for a specific type mapping in a single  
> index, thats why I added this to master:
> 
> [Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/closed#issue/838).
> 
> On Friday, April 8, 2011 at 11:37 PM, Manuel Antonio Benavides Salazar  
> wrote:
> 
> Sure this is what I run:
> 
> curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> {"company":{  
> "item":{"  
> properties":{  
> "model":{"type":"string"},  
> "itemID":{"type":"integer"},  
> "listingDate":{"format":"dateOptionalTime","type":"date"},  
> "condition":{"type":"string"},  
> "type":{"type":"string"},  
> "mainImage":{"type":"string"},  
> "percOff":{"type":"float"},  
> "size":{"type":"string"},  
> "username":{"type":"string"},  
> "category":{"type":"string"},  
> "title":{"type":"string"},  
> "price":{"type":"float"},  
> "msrp":{"type":"float"},  
> "description":{"type":"string"},  
> "brand":{"type":"string"}  
> }  
> }  
> }}'
> 
> And when I do I get back:
> 
> {"ok":true,"acknowledged":true}
> 
> I tried with a fresh index with nothing indexed and still don't work, I  
> just read that you can send a mapping when you create the index so I'll try  
> that right now.
> 
> thanks,
> 
> On Fri, Apr 8, 2011 at 12:27 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> Can you provide a curl recreation? [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help).
> 
> On Friday, April 8, 2011 at 5:13 PM, Manuel Antonio Benavides Salazar  
> wrote:
> 
> geartrade just the name of the index I changed it on the other places for  
> testing and forgot that one on the console I am running it OK so the syntax  
> is not wrong, I think then it just shouldn't say that the mapping was  
> updated successfully as it does, I'll give it a try with a newly fresh  
> index.
> 
> On Fri, Apr 8, 2011 at 1:57 AM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:
> 
> On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:
> 
> > I have the following default mapping:
> > 
> > {"company" : {"item" : {"properties" : {  
> > "model" : {"type" : "string"},  
> > "itemID" : {"type" : "string"},  
> > ... trimmed ...  
> > "description" : { "type" : "string"},  
> > "brand" : { "type" : "string"}}}}}
> > 
> > Then I go and change some values and I'll need to sort them and run  
> > queries with ranges on some of them with the following command:
> > 
> > curl -XPUT '[http://localhost:9200/company/item/\_mapping](http://localhost:9200/company/item/_mapping)' -d '  
> > {"geartrade":{"item":{"properties":{  
> > "model":{"type":"string"},
> 
> Where does "geartrade" come from?
> 
> Your mapping syntax is wrong.
> 
> Also, you can only update a mapping if it doesn't conflict with the  
> existing mapping. Otherwise, you need to create a new type with the new  
> mapping (perhaps in a new index), and reindex your data with the new  
> mapping.
> 
> clint

---

<div class="post-metadata">

**Author:** ![Manuel\_Benavides](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Manuel\_Benavides](https://discuss.elastic.co/u/Manuel_Benavides)\
**Post date:** [April 9, 2011, 10:01pm UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/12 "2011-04-09T22:01:14Z")

</div>

Thanks a lot Shay's suggestion totally worked for me and thanks for the  
recommendation I'll do it that way as the mapping automatically created  
doesn't match all elements as I need them.

cheers,

On Thu, Apr 7, 2011 at 4:55 PM, AGuereca [aguereca@gmail.com](mailto:aguereca@gmail.com) wrote:

> Hi Manuel,
> 
> Mapping is recommended to be defined at the time you are actually creating  
> the index.  
> Once the index is created either explicitly or because you insert a  
> document  
> (and a default mapping is created for you), very few settings are available  
> of change.
> 
> I'll suggest reviewing:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html)
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html)  
> And  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/)
> 
> ~AG
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/changing-default-mapping-tp2792694p2792755.html](http://elasticsearch-users.115913.n3.nabble.com/changing-default-mapping-tp2792694p2792755.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Barsk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/barsk/32/13734_2.png) [@Barsk](https://discuss.elastic.co/u/Barsk)\
**Post date:** [April 11, 2011, 6:39am UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/13 "2011-04-11T06:39:11Z")

</div>

```
Ok!

Thanks for clearing that out. Now I understand what aliases can be
used for as well. :)

Btw, as I an afterthought, would it not be nice to have a method in
ES to do the reindexing for you. I.e internally create a new tmp
index, reindex with the scan search type and efter all is done
return to you a complete reindexed index with the same name as
before. If possible it could even be done in production and
seamlessly switching the old index for the new when the process is
done. The API method for this could simply be "reindex".

Just a thought, as reindexing seems to be a fairly common procedure
while doing configuration changes.

/Kristian

Shay Banon skrev 2011-04-08 20:23:
<blockquote cite="mid:371DC248F11A4770AD25BCF9B1B2B8B1@elasticsearch.com" type="cite">Hey,

```

Â Â Reindexing means just that, go over what you have  
indexed up until now and index it back. In terms of managing  
indices with elasticsearch, it is recommended to reindex  
into a fresh index the data (possibly using updated  
mappings), and then hot swap it using aliases.

Â Â Getting the data to reindex can be done either by  
going to your where your master data is stored, and index it  
again (for example, from the database), or, get it from  
elasticsearch. Getting it from elasticsearch in an efficient  
manner will be possible in the upcoming version using the  
scan search type (already in master).

Â Â Refresh is the process of making changes done  
(indexing for example) visible to search. It is not related  
to indexing.

-shay.banon

On Friday, April 8, 2011 at 4:05 PM, David Pilato wrote:

> I think you have only to push again all your documents to elastic search.
> 
> ```
> Elastic will update the mapping (or will use the new
> mapping if you have
> 
> provided it to ES just before) and will update each
> document. So you don't
> 
> have to delete anything.
> 
> Hope this helps,
> 
> David
> 
> -----Message d'origine-----
> 
> DeÂ : Kristian JÃ¶rg [<a moz-do-not-send="true" href="mailto:krjg@devo.se">mailto:krjg@devo.se</a>]
>               
> 
> EnvoyÃ©Â : vendredi 8 avril 2011 11:34
> 
> ÃÂ : <a moz-do-not-send="true" href="mailto:users@elasticsearch.com">users@elasticsearch.com</a>
> 
> ObjetÂ : Reindex &amp; refresh?
> 
> I see a lot of references to "reindexing" the index in
> the mailing list. 
> 
> But I am a bit unsure of what that really means.
> 
> For instance when you change the mappings for a type
> reindexing is needed.
> 
> How do I do that?
> 
> Is there an API method to call?
> 
> Do I have to delete all contents and store again?
> 
> Is reindexing the same as refresh? If not what is
> really refresh then?
> 
> Well, a bit of a newbie questions, but I am sure easy
> to answer for anyone
> 
> who knows...
> 
> ```

```
-- 
Med vÃ¤nlig hÃ¤lsning
Kristian JÃ¶rg

Devo IT AB
Tel: 054 - 22 14 58, 0709 - 15 83 42
E-post:[kristian.jorg@devo.se](mailto:kristian.jorg@devo.se)Webb:[http://www.devo.se](http://www.devo.se)
```

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 11, 2011, 8:20am UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/14 "2011-04-11T08:20:31Z")

</div>

A reindex API is certainly possible, the main effort was getting the scan API first.  
On Monday, April 11, 2011 at 9:39 AM, Kristian JÃ¶rg wrote:

> Ok!
> 
> Thanks for clearing that out. Now I understand what aliases can be used for as well. 🙂
> 
> Btw, as I an afterthought, would it not be nice to have a method in ES to do the reindexing for you. I.e internally create a new tmp index, reindex with the scan search type and efter all is done return to you a complete reindexed index with the same name as before. If possible it could even be done in production and seamlessly switching the old index for the new when the process is done. The API method for this could simply be "reindex".
> 
> Just a thought, as reindexing seems to be a fairly common procedure while doing configuration changes.
> 
> /Kristian
> 
> Shay Banon skrev 2011-04-08 20:23:
> 
> > Hey,
> > 
> > Reindexing means just that, go over what you have indexed up until now and index it back. In terms of managing indices with elasticsearch, it is recommended to reindex into a fresh index the data (possibly using updated mappings), and then hot swap it using aliases.
> > 
> > Getting the data to reindex can be done either by going to your where your master data is stored, and index it again (for example, from the database), or, get it from elasticsearch. Getting it from elasticsearch in an efficient manner will be possible in the upcoming version using the scan search type (already in master).
> > 
> > Refresh is the process of making changes done (indexing for example) visible to search. It is not related to indexing.
> > 
> > -shay.banon  
> > On Friday, April 8, 2011 at 4:05 PM, David Pilato wrote:
> > 
> > > I think you have only to push again all your documents to Elasticsearch.
> > > 
> > > Elastic will update the mapping (or will use the new mapping if you have  
> > > provided it to ES just before) and will update each document. So you don't  
> > > have to delete anything.
> > > 
> > > Hope this helps,  
> > > David
> > > 
> > > -----Message d'origine-----  
> > > De : Kristian JÃ¶rg [[mailto:krjg@devo.se](mailto:krjg@devo.se)]  
> > > EnvoyÃ© : vendredi 8 avril 2011 11:34  
> > > Ã : [users@elasticsearch.com](mailto:users@elasticsearch.com)  
> > > Objet : Reindex & refresh?
> > > 
> > > I see a lot of references to "reindexing" the index in the mailing list.  
> > > But I am a bit unsure of what that really means.  
> > > For instance when you change the mappings for a type reindexing is needed.  
> > > How do I do that?
> > > 
> > > Is there an API method to call?  
> > > Do I have to delete all contents and store again?  
> > > Is reindexing the same as refresh? If not what is really refresh then?
> > > 
> > > Well, a bit of a newbie questions, but I am sure easy to answer for anyone  
> > > who knows...
> 
> -- Med vÃ¤nlig hÃ¤lsning Kristian JÃ¶rg Devo IT AB Tel: 054 - 22 14 58, 0709 - 15 83 42 E-post: kristian.jorg@devo.se Webb: [http://www.devo.se](http://www.devo.se)

---

<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, 4:08am UTC](https://discuss.elastic.co/t/changing-default-mapping/4202/15 "2017-07-06T04:08:38Z")

</div>


