# API call to see the mappings of an existing index

**URL:** <https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125>\
**Category:** Elasticsearch\
**Created:** [July 20, 2010, 5:21pm UTC](https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125 "2010-07-20T17:21:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Berkay\_Mollamustafao](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Berkay\_Mollamustafao](https://discuss.elastic.co/u/Berkay_Mollamustafao)\
**Post date:** [July 20, 2010, 5:21pm UTC](https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125/1 "2010-07-20T17:21:29Z")

</div>

Greetings,

I have couple of questions:

1. Is there an API call that outputs the mappings of an existing index? I  
see how to get shard/replica info but could not find the call to print out  
the mappings of each of the fields.
2. Is there a way to assign defaults (not analyzed etc) to fields that will  
be dynamically added later on?

Pointers to docs if they exist would be much appreciated.

Regards,  
Berkay Mollamustafaoglu  
mberkay on yahoo, google and skype

---

<div class="post-metadata">

**Author:** ![Andrew\_Harvey\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_harvey_2/32/3328_2.png) [@Andrew\_Harvey\_2](https://discuss.elastic.co/u/Andrew_Harvey_2)\
**Post date:** [July 20, 2010, 5:29pm UTC](https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125/2 "2010-07-20T17:29:13Z")

</div>

On 20/07/2010, at 10:21 AM, Berkay Mollamustafaoglu wrote:

> Greetings,
> 
> I have couple of questions:
> 
> 1. Is there an API call that outputs the mappings of an existing index? I see how to get shard/replica info but could not find the call to print out the mappings of each of the fields.

I don't know that it's _the_ way, but off the top of my head, I hit [http://localhost:9200/\_cluster/state](http://localhost:9200/_cluster/state) which returns among other things the mappings on the nodes.

> 1. Is there a way to assign defaults (not analyzed etc) to fields that will be dynamically added later on?

I'm not sure of exactly what you need to put in here, but it looks like this is what you're looking for: [http://www.elasticsearch.com/docs/elasticsearch/index\_modules/mapper/#Dynamic\_Mappings](http://www.elasticsearch.com/docs/elasticsearch/index_modules/mapper/#Dynamic_Mappings)

## Andrew Harvey / Developer lexer m/ t/ +61 2 9019 6379 w/ [http://lexer.com.au](http://lexer.com.au) Help put an end to whaling. Visit [http://www.givewhalesavoice.com.au/](http://www.givewhalesavoice.com.au/)

Please consider the environment before printing this email  
This email transmission is confidential and intended solely for the person or organisation to whom it is addressed. If you are not the intended recipient, you must not copy, distribute or disseminate the information, or take any action in relation to it and please delete this e-mail. Any views expressed in this message are those of the individual sender, except where the send specifically states them to be the views of any organisation or employer. If you have received this message in error, do not open any attachment but please notify the sender (above). This message has been checked for all known viruses powered by McAfee.

For further information visit [McAfee AI-Powered Antivirus, Scam, Identity, and Privacy Protection](http://www.mcafee.com/us/threat_center/default.asp)  
Please rely on your own virus check as no responsibility is taken by the sender for any damage rising out of any virus infection this communication may contain.

This message has been scanned for malware by Websense. [www.websense.com](http://www.websense.com)

---

<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:** [July 20, 2010, 5:32pm UTC](https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125/3 "2010-07-20T17:32:25Z")

</div>

Some additions:

1. The cluster state API gives you back the mappings for indices. In 0.9, if  
you are using the REST API, then there are three endpoints to get all  
mappings, all mappings for an index (or indices), and mappings for a  
specific index and type.

2. You can use the put mapping API to define in advance mappings for  
specific fields. Is that what you are after?

-shay.banon

On Tue, Jul 20, 2010 at 8:29 PM, Andrew Harvey  
[Andrew.Harvey@lexer.com.au](mailto:Andrew.Harvey@lexer.com.au)wrote:

> On 20/07/2010, at 10:21 AM, Berkay Mollamustafaoglu wrote:
> 
> > Greetings,
> > 
> > I have couple of questions:
> > 
> > 1. Is there an API call that outputs the mappings of an existing index?  
> > I see how to get shard/replica info but could not find the call to print  
> > out the mappings of each of the fields.
> 
> I don't know that it's _the_ way, but off the top of my head, I hit  
> [http://localhost:9200/\_cluster/state](http://localhost:9200/_cluster/state) which returns among other things the  
> mappings on the nodes.
> 
> > 1. Is there a way to assign defaults (not analyzed etc) to fields that  
> > will be dynamically added later on?
> 
> I'm not sure of exactly what you need to put in here, but it looks like  
> this is what you're looking for:  
> [http://www.elasticsearch.com/docs/elasticsearch/index\_modules/mapper/#Dynamic\_Mappings](http://www.elasticsearch.com/docs/elasticsearch/index_modules/mapper/#Dynamic_Mappings)
> 
> ## Andrew Harvey / Developer lexer m/ t/ +61 2 9019 6379 w/ [http://lexer.com.au](http://lexer.com.au) Help put an end to whaling. Visit [http://www.givewhalesavoice.com.au/](http://www.givewhalesavoice.com.au/)
> 
> Please consider the environment before printing this email  
> This email transmission is confidential and intended solely for the person  
> or organisation to whom it is addressed. If you are not the intended  
> recipient, you must not copy, distribute or disseminate the information, or  
> take any action in relation to it and please delete this e-mail. Any views  
> expressed in this message are those of the individual sender, except where  
> the send specifically states them to be the views of any organisation or  
> employer. If you have received this message in error, do not open any  
> attachment but please notify the sender (above). This message has been  
> checked for all known viruses powered by McAfee.
> 
> For further information visit  
> [Advanced Research Center | Trellix](http://www.mcafee.com/us/threat_center/default.asp)  
> Please rely on your own virus check as no responsibility is taken by the  
> sender for any damage rising out of any virus infection this communication  
> may contain.
> 
> This message has been scanned for malware by Websense. [www.websense.com](http://www.websense.com)

---

<div class="post-metadata">

**Author:** ![Berkay\_Mollamustafa1](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@Berkay\_Mollamustafa1](https://discuss.elastic.co/u/Berkay_Mollamustafa1)\
**Post date:** [July 20, 2010, 5:39pm UTC](https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125/4 "2010-07-20T17:39:04Z")

</div>

For 2 I think I was after what Andrew pointed to. I read it again after  
Andrew pointed out and this time it made sense.  
It's not defining advanced mappings for specific fields as I don't know what  
the fields will be. I just want to be able to configure the defaults for any  
additional fields to not\_analyzed, etc.

I take it I can specify that in the _default_ of dynamic mappings as  
described in that page?

Regards,  
Berkay Mollamustafaoglu  
mberkay on yahoo, google and skype

On Tue, Jul 20, 2010 at 1:32 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Some additions:
> 
> 1. The cluster state API gives you back the mappings for indices. In 0.9,  
> if you are using the REST API, then there are three endpoints to get all  
> mappings, all mappings for an index (or indices), and mappings for a  
> specific index and type.
> 
> 2. You can use the put mapping API to define in advance mappings for  
> specific fields. Is that what you are after?
> 
> -shay.banon
> 
> On Tue, Jul 20, 2010 at 8:29 PM, Andrew Harvey \<Andrew.Harvey@lexer.com.au
> 
> > wrote:
> 
> > On 20/07/2010, at 10:21 AM, Berkay Mollamustafaoglu wrote:
> > 
> > > Greetings,
> > > 
> > > I have couple of questions:
> > > 
> > > 1. Is there an API call that outputs the mappings of an existing index?  
> > > I see how to get shard/replica info but could not find the call to print  
> > > out the mappings of each of the fields.
> > 
> > I don't know that it's _the_ way, but off the top of my head, I hit  
> > [http://localhost:9200/\_cluster/state](http://localhost:9200/_cluster/state) which returns among other things the  
> > mappings on the nodes.
> > 
> > > 1. Is there a way to assign defaults (not analyzed etc) to fields that  
> > > will be dynamically added later on?
> > 
> > I'm not sure of exactly what you need to put in here, but it looks like  
> > this is what you're looking for:  
> > [http://www.elasticsearch.com/docs/elasticsearch/index\_modules/mapper/#Dynamic\_Mappings](http://www.elasticsearch.com/docs/elasticsearch/index_modules/mapper/#Dynamic_Mappings)
> > 
> > ## Andrew Harvey / Developer lexer m/ t/ +61 2 9019 6379 w/ [http://lexer.com.au](http://lexer.com.au) Help put an end to whaling. Visit [http://www.givewhalesavoice.com.au/](http://www.givewhalesavoice.com.au/)
> > 
> > Please consider the environment before printing this email  
> > This email transmission is confidential and intended solely for the person  
> > or organisation to whom it is addressed. If you are not the intended  
> > recipient, you must not copy, distribute or disseminate the information, or  
> > take any action in relation to it and please delete this e-mail. Any views  
> > expressed in this message are those of the individual sender, except where  
> > the send specifically states them to be the views of any organisation or  
> > employer. If you have received this message in error, do not open any  
> > attachment but please notify the sender (above). This message has been  
> > checked for all known viruses powered by McAfee.
> > 
> > For further information visit  
> > [Advanced Research Center | Trellix](http://www.mcafee.com/us/threat_center/default.asp)  
> > Please rely on your own virus check as no responsibility is taken by the  
> > sender for any damage rising out of any virus infection this communication  
> > may contain.
> > 
> > This message has been scanned for malware by Websense. [www.websense.com](http://www.websense.com)

---

<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:22am UTC](https://discuss.elastic.co/t/api-call-to-see-the-mappings-of-an-existing-index/3125/5 "2017-07-06T04:22:01Z")

</div>


