# Is there a simple way to get the mapping per index through java api?

**URL:** <https://discuss.elastic.co/t/is-there-a-simple-way-to-get-the-mapping-per-index-through-java-api/5513>\
**Category:** Elasticsearch\
**Created:** [October 4, 2011, 3:59pm UTC](https://discuss.elastic.co/t/is-there-a-simple-way-to-get-the-mapping-per-index-through-java-api/5513 "2011-10-04T15:59:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [October 4, 2011, 3:59pm UTC](https://discuss.elastic.co/t/is-there-a-simple-way-to-get-the-mapping-per-index-through-java-api/5513/1 "2011-10-04T15:59:41Z")

</div>

We're in need of a simple interface where admins can see/modify and  
set again the mappings for the indices.

Getting the mappings can be done through client.admin().cluster(). But  
seems a bit convoluted to just get all the mappings in json format  
through this way.

Can this be done easily? am I looking at the wrong place?

Cheers

---

<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:** [October 4, 2011, 4:20pm UTC](https://discuss.elastic.co/t/is-there-a-simple-way-to-get-the-mapping-per-index-through-java-api/5513/2 "2011-10-04T16:20:03Z")

</div>

The rest endpoint for get mapping uses the cluster state API (with some  
filters), here is the code:  
[https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java](https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java)  
.

On Tue, Oct 4, 2011 at 5:59 PM, maverick [mauricio.alarcon@gmail.com](mailto:mauricio.alarcon@gmail.com) wrote:

> We're in need of a simple interface where admins can see/modify and  
> set again the mappings for the indices.
> 
> Getting the mappings can be done through client.admin().cluster(). But  
> seems a bit convoluted to just get all the mappings in json format  
> through this way.
> 
> Can this be done easily? am I looking at the wrong place?
> 
> Cheers

---

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [October 4, 2011, 4:28pm UTC](https://discuss.elastic.co/t/is-there-a-simple-way-to-get-the-mapping-per-index-through-java-api/5513/3 "2011-10-04T16:28:42Z")

</div>

Just perfect, Thanks Shay!

On Oct 4, 12:20 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> The rest endpoint for get mapping uses the cluster state API (with some  
> filters), here is the code:[https://github.com/elasticsearch/elasticsearch/blob/master/modules/el](https://github.com/elasticsearch/elasticsearch/blob/master/modules/el)...  
> .
> 
> On Tue, Oct 4, 2011 at 5:59 PM, maverick [mauricio.alar...@gmail.com](mailto:mauricio.alar...@gmail.com) wrote:
> 
> > We're in need of a simple interface where admins can see/modify and  
> > set again the mappings for the indices.
> 
> > Getting the mappings can be done through client.admin().cluster(). But  
> > seems a bit convoluted to just get all the mappings in json format  
> > through this way.
> 
> > Can this be done easily? am I looking at the wrong place?
> 
> > Cheers

---

<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:52am UTC](https://discuss.elastic.co/t/is-there-a-simple-way-to-get-the-mapping-per-index-through-java-api/5513/4 "2017-07-06T03:52:50Z")

</div>


