# Modifying Mapping

**URL:** <https://discuss.elastic.co/t/modifying-mapping/3033>\
**Category:** Elasticsearch\
**Created:** [June 22, 2010, 3:34am UTC](https://discuss.elastic.co/t/modifying-mapping/3033 "2010-06-22T03:34:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Doyle](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Samuel\_Doyle](https://discuss.elastic.co/u/Samuel_Doyle)\
**Post date:** [June 22, 2010, 3:34am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/1 "2010-06-22T03:34:48Z")

</div>

Ok so based on a previous suggestion I'm creating a JSON document using  
grails JSON converter and initially creating a index before indexing  
I see that the JSON is formed as I expected and the create request appears  
to go fine, I'm not sure exactly how to query the metadata but this would be  
good for validation.

The possible problem I'm seeing now is this.  
After the creation I send an index request with some data. I see in the logs  
a lot of the following messages.

[20:16:27,787][DEBUG][cluster.metadata] [Blizzard] Index  
[inventory]: Update mapping [sale] (dynamic) with source ...

There is a spew of mapping data following this so why is the mapping being  
updated? Is it because I'm not including all the default values and or  
fields in my initial create?

Thanks

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [June 22, 2010, 7:17am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/2 "2010-06-22T07:17:32Z")

</div>

Hi,

On Tue, Jun 22, 2010 at 5:34 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com) wrote:

> Ok so based on a previous suggestion I'm creating a JSON document using  
> grails JSON converter and initially creating a index before indexing  
> I see that the JSON is formed as I expected and the create request appears  
> to go fine, I'm not sure exactly how to query the metadata but this would be  
> good for validation.

you can get actual index mappings via REST API. Cluster state gives you  
mappings of all indices in cluster:  
[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/admin/cluster/state/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/cluster/state/)  
(actually  
"mappings" section is empty in the example in current doc). If you are using  
master build (you are building 0.9-SNAPSHOT) then there has been added more  
convenient mappings API, see:

> <https://github.com/elastic/elasticsearch/issues/222>
>
> It would be nice to get the mappings of a given index or index/type pair by doin…g a GET.
> 
> For example, I would like to have something like:
> \- "GET /logs/\_mapping" to get all the mappings defined in the "logs" index.
> \- "GET /logs/log/\_mapping" to get the mappings of the "logs/log" type.
> \- "GET /\_mapping" to get all the mappings.
> 
> Note that this is currently possible by doing a GET of "/\_cluster/state" but that also obtains a bunch of non related information, and one still has to parse the json (the mappings come in a json encoded string).

Also note that the cluster state in 0.8 release provides mappings in encoded  
JSON. This has been fixed in master as well.

> The possible problem I'm seeing now is this.  
> After the creation I send an index request with some data. I see in the  
> logs a lot of the following messages.
> 
> [20:16:27,787][DEBUG][cluster.metadata] [Blizzard] Index  
> [inventory]: Update mapping [sale] (dynamic) with source ...
> 
> There is a spew of mapping data following this so why is the mapping being  
> updated? Is it because I'm not including all the default values and or  
> fields in my initial create?
> 
> Thanks

Regards,  
Lukas

---

<div class="post-metadata">

**Author:** ![Samuel\_Doyle](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Samuel\_Doyle](https://discuss.elastic.co/u/Samuel_Doyle)\
**Post date:** [June 22, 2010, 8:50am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/3 "2010-06-22T08:50:57Z")

</div>

Thanks for the info!

I was aware of the cluster state api but when I looked at the example in the  
docs it didn't have the mapping section as you had pointed out.

Do you have an idea why I'm seeing all the dynamic updates happening? I know  
it is a debug message but the mapping is changing with my indexing.  
I'm assuming this is because the original mapping didn't contain all the  
properties per each field that might be necessary?

Thanks.

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [June 22, 2010, 8:57am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/4 "2010-06-22T08:57:11Z")

</div>

On Tue, Jun 22, 2010 at 10:50 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com)wrote:

> Thanks for the info!
> 
> I was aware of the cluster state api but when I looked at the example in  
> the docs it didn't have the mapping section as you had pointed out.
> 
> Do you have an idea why I'm seeing all the dynamic updates happening? I  
> know it is a debug message but the mapping is changing with my indexing.  
> I'm assuming this is because the original mapping didn't contain all the  
> properties per each field that might be necessary?

I think it can be the case that your initial mapping did not contain all the  
fields that are found in the documents you are indexing later.

> Thanks.

---

<div class="post-metadata">

**Author:** ![Samuel\_Doyle](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Samuel\_Doyle](https://discuss.elastic.co/u/Samuel_Doyle)\
**Post date:** [June 22, 2010, 9:07am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/5 "2010-06-22T09:07:36Z")

</div>

Alright so these are default values being added since I am not adding new  
fields during indexing.  
Perhaps if this is the case than these default fields should be added during  
the create index and not just during the index request.

S.D.

On Tue, Jun 22, 2010 at 1:57 AM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> On Tue, Jun 22, 2010 at 10:50 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com)wrote:
> 
> > Thanks for the info!
> > 
> > I was aware of the cluster state api but when I looked at the example in  
> > the docs it didn't have the mapping section as you had pointed out.
> > 
> > Do you have an idea why I'm seeing all the dynamic updates happening? I  
> > know it is a debug message but the mapping is changing with my indexing.  
> > I'm assuming this is because the original mapping didn't contain all the  
> > properties per each field that might be necessary?
> 
> I think it can be the case that your initial mapping did not contain all  
> the fields that are found in the documents you are indexing later.
> 
> > Thanks.

---

<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:** [June 22, 2010, 9:33am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/6 "2010-06-22T09:33:11Z")

</div>

The mapping update happens, as suggested, when you index a document that has  
additional fields that are not mapped, this causes an update to the mapping  
definitions.

-shay.banon

On Tue, Jun 22, 2010 at 12:07 PM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com)wrote:

> Alright so these are default values being added since I am not adding new  
> fields during indexing.  
> Perhaps if this is the case than these default fields should be added  
> during the create index and not just during the index request.
> 
> S.D.
> 
> On Tue, Jun 22, 2010 at 1:57 AM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com)wrote:
> 
> > On Tue, Jun 22, 2010 at 10:50 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com)wrote:
> > 
> > > Thanks for the info!
> > > 
> > > I was aware of the cluster state api but when I looked at the example in  
> > > the docs it didn't have the mapping section as you had pointed out.
> > > 
> > > Do you have an idea why I'm seeing all the dynamic updates happening? I  
> > > know it is a debug message but the mapping is changing with my indexing.  
> > > I'm assuming this is because the original mapping didn't contain all the  
> > > properties per each field that might be necessary?
> > 
> > I think it can be the case that your initial mapping did not contain all  
> > the fields that are found in the documents you are indexing later.
> > 
> > > Thanks.

---

<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:23am UTC](https://discuss.elastic.co/t/modifying-mapping/3033/7 "2017-07-06T04:23:05Z")

</div>


