# Elasticsearch Java api client get index mapping in a Map

**URL:** <https://discuss.elastic.co/t/elasticsearch-java-api-client-get-index-mapping-in-a-map/311461>\
**Category:** Elasticsearch\
**Created:** [August 4, 2022, 10:12pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-get-index-mapping-in-a-map/311461 "2022-08-04T22:12:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ijaxahmed](https://avatars.discourse-cdn.com/v4/letter/i/f17d59/32.png) [@ijaxahmed](https://discuss.elastic.co/u/ijaxahmed)\
**Post date:** [August 4, 2022, 10:12pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-get-index-mapping-in-a-map/311461/1 "2022-08-04T22:12:03Z")

</div>

I have two qestion  
1- I want to get mapping of an Index in a map as "Map\<String, Object\>", i successfully get the GetMappingResponse but from there not getting what to do in order to get mapping as a "Map\<String, Object\>",

```auto
GetMappingResponse mappingResponse = getElasticsearchClient().indices().getMapping(getMappingRequestBuilder-> getMappingRequestBuilder.index("indexname"));

```

2, if i have "JsonData" that contains mapping , how can i get "Map\<String, Object\>", from it ?

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [August 4, 2022, 11:27pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-get-index-mapping-in-a-map/311461/2 "2022-08-04T23:27:52Z")

</div>

Hi @ijaxahmed

with code below you have access to the map of property.

> Map\<String, Property\> map = getMappingResponse.get("indexname").mappings().properties();

---

<div class="post-metadata">

**Author:** ![ijaxahmed](https://avatars.discourse-cdn.com/v4/letter/i/f17d59/32.png) [@ijaxahmed](https://discuss.elastic.co/u/ijaxahmed)\
**Post date:** [August 5, 2022, 7:42am UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-get-index-mapping-in-a-map/311461/3 "2022-08-05T07:42:11Z")

</div>

Thank you @RabBit_BR for that , But i am specifically looking for Map of Object like this "Map\<String, Object\>", because I have another "Map\<String, Object\>" from a mapping json file and i want to compare both for differences.Actually I want to compare mapping of index with another mapping file

---

<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:** [September 2, 2022, 7:43am UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-get-index-mapping-in-a-map/311461/4 "2022-09-02T07:43:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
