# Elasticsearch geo\_point mapping issue

**URL:** <https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222>\
**Category:** Elasticsearch\
**Created:** [January 12, 2018, 6:12am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222 "2018-01-12T06:12:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thealitahir](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@thealitahir](https://discuss.elastic.co/u/thealitahir)\
**Post date:** [January 12, 2018, 6:12am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/1 "2018-01-12T06:12:53Z")

</div>

I'm working on node js (version 6.1.0 ) application and using elasticsearch (version 5.0.1) in it. But I'm having issues in geo\_point query.

The schema of my elasticsearch after assigning mapping is as follows,

```
{
"newtesting": {
	"aliases": {},
	"mappings": {
		"newtesting": {
			"properties": {
				"location": {
					"properties": {
						"pin": {
							"properties": {
								"location": {
									"type": "geo_shape"
								}
							}
						}
					}
				}
			}
		}
	},

```

and when I insert values through this code,

```
    PUT /newtesting/newtesting/1
{
"pin" : {
    "location" : {
        "lat" : 40.12,
        "lon" : -71.34
    }
}

```

}

then my mapping gets changed like this,

```
{
"newtesting": {
	"aliases": {},
	"mappings": {
		"newtesting": {
			"properties": {
				"location": {
					"properties": {
						"pin": {
							"properties": {
								"location": {
									"type": "geo_shape"
								}
							}
						}
					}
				},
				"pin": {
					"properties": {
						"location": {
							"properties": {
								"lat": {
									"type": "float"
								},
								"lon": {
									"type": "float"
								}
							}
						}
					}
				}
			}
		}
	},

```

Due to which my geo\_point search query gives this error

"[query\_shard\_exception] failed to find geo\_point field [pin.location]"

Anyone who has some idea about this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 12, 2018, 6:39am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/2 "2018-01-12T06:39:23Z")

</div>

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with `</>` icon. Check the preview window.

Please update your question.

---

<div class="post-metadata">

**Author:** ![thealitahir](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@thealitahir](https://discuss.elastic.co/u/thealitahir)\
**Post date:** [January 12, 2018, 6:51am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/3 "2018-01-12T06:51:00Z")

</div>

Sorry for that, is it okay now?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 12, 2018, 7:11am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/4 "2018-01-12T07:11:06Z")

</div>

Some comments.

The mapping you created indicates that you are writing (I think) in an index called `newtesting` and the document type is `newtesting`.

But then you index with `PUT /my_locations/location/1` where index name is `my_locations` and type is `location`.

Are you sure your example is correct?

Could you provide a full recreation script as described in

> [@About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21):
>
> The heart of the free and open Elastic Stack Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease. warning PLEASE READ THIS SECTION IF IT'S YOUR FIRST POST Some useful links: [elasticsearch reference guide](http://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)[elasticsearch user guide](http://www.elastic.co/guide/en/elasticsearch/guide/current/index.html)[elasticsearch plugins](https://www.elastic.co/guide/en/elasticsearch/plugins/current/index.html)[elasticsearch cl…](https://www.elastic.co/guide/en/elasticsearch/client/index.html)

It will help to better understand what you are doing.  
Please, try to keep the example as simple as possible.

---

<div class="post-metadata">

**Author:** ![thealitahir](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@thealitahir](https://discuss.elastic.co/u/thealitahir)\
**Post date:** [January 12, 2018, 7:18am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/5 "2018-01-12T07:18:07Z")

</div>

sorry there was a typing mistake, see my example again

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 12, 2018, 7:27am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/6 "2018-01-12T07:27:12Z")

</div>

According to your mapping you should write:

```auto
PUT /newtesting/newtesting/1
{
"location" : {
  "pin" : {
    "location" : {
        "lat" : 40.12,
        "lon" : -71.34
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![thealitahir](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@thealitahir](https://discuss.elastic.co/u/thealitahir)\
**Post date:** [January 12, 2018, 10:10am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/7 "2018-01-12T10:10:34Z")

</div>

It worked. Thank you so much for the help

---

<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:** [February 9, 2018, 10:10am UTC](https://discuss.elastic.co/t/elasticsearch-geo-point-mapping-issue/115222/8 "2018-02-09T10:10:48Z")

</div>

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