# Get mapping api in 0.19.0

**URL:** <https://discuss.elastic.co/t/get-mapping-api-in-0-19-0/6918>\
**Category:** Elasticsearch\
**Created:** [March 6, 2012, 6:08pm UTC](https://discuss.elastic.co/t/get-mapping-api-in-0-19-0/6918 "2012-03-06T18:08:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![avasilenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avasilenko/32/2901_2.png) [@avasilenko](https://discuss.elastic.co/u/avasilenko)\
**Post date:** [March 6, 2012, 6:08pm UTC](https://discuss.elastic.co/t/get-mapping-api-in-0-19-0/6918/1 "2012-03-06T18:08:45Z")

</div>

Hello,

I remember it was impossible to retrieve index mappings via java api.  
Workaround was to use REST api. Are there any improvements in java api for  
0.19.0?

Thanks,  
Alexandr Vasilenko

---

<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:** [March 6, 2012, 9:04pm UTC](https://discuss.elastic.co/t/get-mapping-api-in-0-19-0/6918/2 "2012-03-06T21:04:02Z")

</div>

You can use the Java API to get the mapping. Note that all REST endpoints use the Java API to do the actual work, so there isn't anything you can do with rest that you can't do with Java. Some REST endpoints though are more concrete or specialized and use a more generic Java API.

In this case, getting the mapping uses the cluster state API. Here is the REST implementation: [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java#L66](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java#L66).

On Tuesday, March 6, 2012 at 8:08 PM, Alex Vasilenko wrote:

> Hello,
> 
> I remember it was impossible to retrieve index mappings via java api. Workaround was to use REST api. Are there any improvements in java api for 0.19.0?
> 
> Thanks,  
> Alexandr Vasilenko

---

<div class="post-metadata">

**Author:** ![avasilenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avasilenko/32/2901_2.png) [@avasilenko](https://discuss.elastic.co/u/avasilenko)\
**Post date:** [March 6, 2012, 9:32pm UTC](https://discuss.elastic.co/t/get-mapping-api-in-0-19-0/6918/3 "2012-03-06T21:32:43Z")

</div>

Thanks Shay. Next time I'll check source first.

Alex

2012/3/6 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)

> You can use the Java API to get the mapping. Note that all REST endpoints  
> use the Java API to do the actual work, so there isn't anything you can do  
> with rest that you can't do with Java. Some REST endpoints though are more  
> concrete or specialized and use a more generic Java API.
> 
> In this case, getting the mapping uses the cluster state API. Here is the  
> REST implementation:  
> [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java#L66](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java#L66)  
> .
> 
> On Tuesday, March 6, 2012 at 8:08 PM, Alex Vasilenko wrote:
> 
> Hello,
> 
> I remember it was impossible to retrieve index mappings via java api.  
> Workaround was to use REST api. Are there any improvements in java api for  
> 0.19.0?
> 
> Thanks,  
> Alexandr Vasilenko

---

<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:37am UTC](https://discuss.elastic.co/t/get-mapping-api-in-0-19-0/6918/4 "2017-07-06T03:37:01Z")

</div>


