# Types metadata information in an Index?

**URL:** <https://discuss.elastic.co/t/types-metadata-information-in-an-index/11711>\
**Category:** Elasticsearch\
**Created:** [April 26, 2013, 9:24pm UTC](https://discuss.elastic.co/t/types-metadata-information-in-an-index/11711 "2013-04-26T21:24:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [April 26, 2013, 9:24pm UTC](https://discuss.elastic.co/t/types-metadata-information-in-an-index/11711/1 "2013-04-26T21:24:07Z")

</div>

Hi,

Is there a Java API where i can find out all the types defined in an index  
and also metadata information of each type. For example what are the  
fields, type of a field, etc ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Fish\_Tastic](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@Fish\_Tastic](https://discuss.elastic.co/u/Fish_Tastic)\
**Post date:** [April 26, 2013, 9:39pm UTC](https://discuss.elastic.co/t/types-metadata-information-in-an-index/11711/2 "2013-04-26T21:39:38Z")

</div>

I think you are looking mapping of a index type. Here is a code snippet,  
where I get the mapping as a string in Java.

ClusterState clusterState =  
client.admin().cluster().prepareState().setFilterIndices(index).execute().actionGet().getState();

IndexMetaData indexMetaData = clusterState.getMetaData().index(index);

MappingMetaData mappingMetaData = indexMetaData.mapping(type);

_return_ mappingMetaData.getSourceAsMap().toString();

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vinod\_eligeti](https://avatars.discourse-cdn.com/v4/letter/v/c4cdca/32.png) [@vinod\_eligeti](https://discuss.elastic.co/u/vinod_eligeti)\
**Post date:** [April 29, 2013, 6:01pm UTC](https://discuss.elastic.co/t/types-metadata-information-in-an-index/11711/3 "2013-04-29T18:01:54Z")

</div>

Thanks that works.

On Fri, Apr 26, 2013 at 2:39 PM, Fish Tastic [whoisbingo@gmail.com](mailto:whoisbingo@gmail.com) wrote:

> I think you are looking mapping of a index type. Here is a code snippet,  
> where I get the mapping as a string in Java.
> 
> ClusterState clusterState =  
> client.admin().cluster().prepareState().setFilterIndices(index).execute().actionGet().getState();
> 
> IndexMetaData indexMetaData = clusterState.getMetaData().index(index);
> 
> MappingMetaData mappingMetaData = indexMetaData.mapping(type);
> 
> _return_ mappingMetaData.getSourceAsMap().toString();
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/NGnUSgAAfLs/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/NGnUSgAAfLs/unsubscribe?hl=en-US)  
> .  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:39am UTC](https://discuss.elastic.co/t/types-metadata-information-in-an-index/11711/4 "2017-07-06T02:39:12Z")

</div>


