# Nested location object and mapping in elasticsearch

**URL:** <https://discuss.elastic.co/t/nested-location-object-and-mapping-in-elasticsearch/133826>\
**Category:** Elasticsearch\
**Created:** [May 30, 2018, 8:41am UTC](https://discuss.elastic.co/t/nested-location-object-and-mapping-in-elasticsearch/133826 "2018-05-30T08:41:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Lao](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Rahul\_Lao](https://discuss.elastic.co/u/Rahul_Lao)\
**Post date:** [May 30, 2018, 8:41am UTC](https://discuss.elastic.co/t/nested-location-object-and-mapping-in-elasticsearch/133826/1 "2018-05-30T08:41:11Z")

</div>

Hi,

Suppose i have a custom wrapper class which has many fields in it. Some of which are simple primitive fields like strings, integers while other are highly nested fields.

Along with these fields say i have latitude and longitude fields which again can be in some nested location class.

How can i make a mapping for these latitude and longitude fields while creating an index.

Following the [elasticsearch mapping documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html), i was able to create mapping but then while inserting data through java spring api, **the error i got was that location fields should only contain latitude and longitude fields.**

So, the question is how can i have a custom mapping for geo point for some custom location object.

Looking forward to some feedback.

Thanks

P.S. I am trying to achieve this using java and spring.

---

<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:** [June 27, 2018, 8:55am UTC](https://discuss.elastic.co/t/nested-location-object-and-mapping-in-elasticsearch/133826/2 "2018-06-27T08:55:14Z")

</div>

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