# Field mappings under ES 0.90.9

**URL:** <https://discuss.elastic.co/t/field-mappings-under-es-0-90-9/15532>\
**Category:** Elasticsearch\
**Created:** [January 31, 2014, 4:44pm UTC](https://discuss.elastic.co/t/field-mappings-under-es-0-90-9/15532 "2014-01-31T16:44:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andra\_Bennett](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Andra\_Bennett](https://discuss.elastic.co/u/Andra_Bennett)\
**Post date:** [January 31, 2014, 4:44pm UTC](https://discuss.elastic.co/t/field-mappings-under-es-0-90-9/15532/1 "2014-01-31T16:44:26Z")

</div>

I need to retrieve the field mappings for a type under elasticsearch 0.90.9.

ES is running as an embedded local node, and here is how I connect to it  
and retrieve mappings (the result contains an empty map):  
..  
//creates index and mappings  
...  
Client client =  
NodeBuilder.nodeBuilder().clusterName(CLUSTER\_NAME).local(true).client(true).node().client();  
GetFieldMappingsRequest getMappingsRequest =  
new  
GetFieldMappingsRequest().indices(INDEX\_NAME).types(TYPE\_NAME).local(true).includeDefaults(true);  
GetFieldMappingsResponse response =  
client.admin().indices().getFieldMappings(getMappingsRequest).actionGet();

The problem is that the mappings returned are empty.

Any suggestions appreciated. Thanks!

Andra

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ed5e9d03-b1e0-4e06-8d4a-e185d06ed771%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ed5e9d03-b1e0-4e06-8d4a-e185d06ed771%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [January 31, 2014, 9:21pm UTC](https://discuss.elastic.co/t/field-mappings-under-es-0-90-9/15532/2 "2014-01-31T21:21:23Z")

</div>

Andra,

If you want the entire mapping for the type, you can do something like this:

```
  ClusterStateResponse csr = 

```

client.admin().cluster().prepareState().get();  
ImmutableOpenMap\<String, MappingMetaData\> mappings =  
csr.getState().metaData().index("").getMappings();  
MappingMetaData typeMapping = mappings.get("");  
System.out.println(typeMapping.source().string());

If you just want mappings for specific fields, you can use your method but  
you need to specify the fields:

GetFieldMappingsRequest request = new  
GetFieldMappingsRequest().indices("").types("").fields("");

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/80805204-89d1-487a-8f8f-cf0ae76e9b8c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/80805204-89d1-487a-8f8f-cf0ae76e9b8c%40googlegroups.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, 1:53am UTC](https://discuss.elastic.co/t/field-mappings-under-es-0-90-9/15532/3 "2017-07-06T01:53:33Z")

</div>


