# Get mapping through org.elasticsearch.client.Client

**URL:** <https://discuss.elastic.co/t/get-mapping-through-org-elasticsearch-client-client/6024>\
**Category:** Elasticsearch\
**Created:** [November 30, 2011, 1:10pm UTC](https://discuss.elastic.co/t/get-mapping-through-org-elasticsearch-client-client/6024 "2011-11-30T13:10:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ridvan\_Gyundogan](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Ridvan\_Gyundogan](https://discuss.elastic.co/u/Ridvan_Gyundogan)\
**Post date:** [November 30, 2011, 1:10pm UTC](https://discuss.elastic.co/t/get-mapping-through-org-elasticsearch-client-client/6024/1 "2011-11-30T13:10:34Z")

</div>

Hi guys,  
if someone can give a hint how to get the mapping information through  
org.elasticsearch.client.Client.

> <https://gist.github.com/anonymous/1409001>

  
The gist above always returns false.

---

<div class="post-metadata">

**Author:** ![Ridvan\_Gyundogan](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Ridvan\_Gyundogan](https://discuss.elastic.co/u/Ridvan_Gyundogan)\
**Post date:** [November 30, 2011, 1:43pm UTC](https://discuss.elastic.co/t/get-mapping-through-org-elasticsearch-client-client/6024/2 "2011-11-30T13:43:11Z")

</div>

Ok I found this article  
[http://groups.google.com/group/elasticsearch/browse\_thread/thread/278b52de3be37c08/445dacab328a6a6d?lnk=gst&q=mapping+Client#445dacab328a6a6d](http://groups.google.com/group/elasticsearch/browse_thread/thread/278b52de3be37c08/445dacab328a6a6d?lnk=gst&q=mapping+Client#445dacab328a6a6d)  
which replies to my question.

On Nov 30, 3:10 pm, Ridvan Gyundogan [ridva...@gmail.com](mailto:ridva...@gmail.com) wrote:

> Hi guys,  
> if someone can give a hint how to get the mapping information through  
> org.elasticsearch.client.Client.[get mapping with org.elasticsearch.client.Client · GitHub](https://gist.github.com/1409001)  
> The gist above always returns false.

---

<div class="post-metadata">

**Author:** ![Ridvan\_Gyundogan](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Ridvan\_Gyundogan](https://discuss.elastic.co/u/Ridvan_Gyundogan)\
**Post date:** [November 30, 2011, 2:43pm UTC](https://discuss.elastic.co/t/get-mapping-through-org-elasticsearch-client-client/6024/3 "2011-11-30T14:43:24Z")

</div>

And here is a method if someone needs it:  
public MappingMetaData getIndexMetaData(Client esClient, String  
indexName,  
String documentType) {  
ClusterStateRequest clusterStateRequest = new ClusterStateRequest();  
clusterStateRequest.filteredIndices(indexName);  
ClusterStateResponse clusterStateResponse =  
esClient.admin().cluster().state(clusterStateRequest).actionGet();  
MetaData metaData = clusterStateResponse.state().metaData();  
MappingMetaData mappingMetaData = null;  
for(IndexMetaData indexMetaData : metaData){  
mappingMetaData =  
indexMetaData.getMappings().get(documentType);  
if(mappingMetaData!=null){  
break;  
}  
}  
return mappingMetaData;  
}

On Nov 30, 3:43 pm, Ridvan Gyundogan [ridva...@gmail.com](mailto:ridva...@gmail.com) wrote:

> Ok I found this articlehttp://groups.google.com/group/elasticsearch/browse\_thread/thread/278...  
> which replies to my question.
> 
> On Nov 30, 3:10 pm, Ridvan Gyundogan [ridva...@gmail.com](mailto:ridva...@gmail.com) wrote:
> 
> > Hi guys,  
> > if someone can give a hint how to get the mapping information through  
> > org.elasticsearch.client.Client.[get mapping with org.elasticsearch.client.Client · GitHub](https://gist.github.com/1409001)  
> > The gist above always returns false.

---

<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:46am UTC](https://discuss.elastic.co/t/get-mapping-through-org-elasticsearch-client-client/6024/4 "2017-07-06T03:46:55Z")

</div>


