# Elasticsearch \_geo\_distance Sorting Error

**URL:** <https://discuss.elastic.co/t/elasticsearch--geo-distance-sorting-error/19155>\
**Category:** Elasticsearch\
**Created:** [August 8, 2014, 4:02am UTC](https://discuss.elastic.co/t/elasticsearch--geo-distance-sorting-error/19155 "2014-08-08T04:02:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohannad\_Saeed](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mohannad\_Saeed](https://discuss.elastic.co/u/Mohannad_Saeed)\
**Post date:** [August 8, 2014, 4:02am UTC](https://discuss.elastic.co/t/elasticsearch--geo-distance-sorting-error/19155/1 "2014-08-08T04:02:04Z")

</div>

Greetings,

I am wondering why am I getting this error by elasticsearch (1.2.2) using  
the official nodejs client?

Parse Failure [No mapping found for [[object Object]] in order to sort on]]  
"sort":[{"\_score":{}},{"[object Object]":{}}]

Here is my query (in JSON format):

{  
"index":"myidx",  
"type":"mytype",  
"body":{  
"query":{  
"filtered":{  
"filter":{  
"and":[  
{"term":{"to":"WORLD"}},  
{"or":[  
{"term":{"invisible":false}},  
{"term":{"user":"@geeko"}}  
]},  
{"term":{"blocked":false}}  
]  
},  
"query":{"terms":{"text":["world"]}}  
}  
}  
},  
"sort":[  
"\_score",  
{"\_geo\_distance":{"mytype.location":"0.0,0.0"}}  
],  
"from":0,  
"size":20  
}

BTW, all of my mappings are defined (specifically mytype.location is  
geo\_point), and this query works if I remove the \_geo\_distance sorting.

Kind regards

UPDATE (Mappings and Samples):

{  
"template": "myidx",  
"mytype": {  
"dynamic": "strict",  
"properties": {  
"id": {"type": "long"},  
"timestamp": {  
"type": "date",  
"format": "date\_time"  
},  
"location": {"type": "geo\_point"},  
"user": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"text": {  
"type": "string",  
"analyzer": "simple"  
},  
"to": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"invisible": {"type": "boolean"},  
"blocked": {"type": "boolean"}  
}  
}  
}  
}

{  
"id":"1",  
"timestamp":"2014-08-07T20:35:40.936Z",  
"location":"10.0,10.0",  
"user":"@geeko",  
"text":"Hello World!",  
"to":"WORLD",  
"invisible":false,  
"blocked":false  
}

--  
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/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [August 8, 2014, 5:48am UTC](https://discuss.elastic.co/t/elasticsearch--geo-distance-sorting-error/19155/2 "2014-08-08T05:48:37Z")

</div>

Wondering if it works if you remove mytype.

{"\_geo\_distance":{"location":"0.0,0.0"}}

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 août 2014 à 06:02, Mohannad Saeed [geekox86@gmail.com](mailto:geekox86@gmail.com) a écrit :

Greetings,

I am wondering why am I getting this error by elasticsearch (1.2.2) using the official nodejs client?

Parse Failure [No mapping found for [[object Object]] in order to sort on]]  
"sort":[{"\_score":{}},{"[object Object]":{}}]  
Here is my query (in JSON format):

{  
"index":"myidx",  
"type":"mytype",  
"body":{  
"query":{  
"filtered":{  
"filter":{  
"and":[  
{"term":{"to":"WORLD"}},  
{"or":[  
{"term":{"invisible":false}},  
{"term":{"user":"@geeko"}}  
]},  
{"term":{"blocked":false}}  
]  
},  
"query":{"terms":{"text":["world"]}}  
}  
}  
},  
"sort":[  
"\_score",  
{"\_geo\_distance":{"mytype.location":"0.0,0.0"}}  
],  
"from":0,  
"size":20  
}  
BTW, all of my mappings are defined (specifically mytype.location is geo\_point), and this query works if I remove the \_geo\_distance sorting.

Kind regards

UPDATE (Mappings and Samples):

{  
"template": "myidx",  
"mytype": {  
"dynamic": "strict",  
"properties": {  
"id": {"type": "long"},  
"timestamp": {  
"type": "date",  
"format": "date\_time"  
},  
"location": {"type": "geo\_point"},  
"user": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"text": {  
"type": "string",  
"analyzer": "simple"  
},  
"to": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"invisible": {"type": "boolean"},  
"blocked": {"type": "boolean"}  
}  
}  
}  
}

## { "id":"1", "timestamp":"2014-08-07T20:35:40.936Z", "location":"10.0,10.0", "user":"@geeko", "text":"Hello World!", "to":"WORLD", "invisible":false, "blocked":false }

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/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/7D44B8B8-DD0D-4858-8872-D980CD5CBF7D%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/7D44B8B8-DD0D-4858-8872-D980CD5CBF7D%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mohannad\_Saeed](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mohannad\_Saeed](https://discuss.elastic.co/u/Mohannad_Saeed)\
**Post date:** [August 8, 2014, 5:55am UTC](https://discuss.elastic.co/t/elasticsearch--geo-distance-sorting-error/19155/3 "2014-08-08T05:55:40Z")

</div>

Hi David,

Tried it, not working for me ☹

On Friday, August 8, 2014 8:48:51 AM UTC+3, David Pilato wrote:

> Wondering if it works if you remove mytype.
> 
> {"\_geo\_distance":{"location":"0.0,0.0"}}
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 8 août 2014 à 06:02, Mohannad Saeed \<[geek...@gmail.com](mailto:geek...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> Greetings,
> 
> I am wondering why am I getting this error by elasticsearch (1.2.2) using  
> the official nodejs client?
> 
> Parse Failure [No mapping found for [[object Object]] in order to sort on]]  
> "sort":[{"\_score":{}},{"[object Object]":{}}]
> 
> Here is my query (in JSON format):
> 
> {  
> "index":"myidx",  
> "type":"mytype",  
> "body":{  
> "query":{  
> "filtered":{  
> "filter":{  
> "and":[  
> {"term":{"to":"WORLD"}},  
> {"or":[  
> {"term":{"invisible":false}},  
> {"term":{"user":"@geeko"}}  
> ]},  
> {"term":{"blocked":false}}  
> ]  
> },  
> "query":{"terms":{"text":["world"]}}  
> }  
> }  
> },  
> "sort":[  
> "\_score",  
> {"\_geo\_distance":{"mytype.location":"0.0,0.0"}}  
> ],  
> "from":0,  
> "size":20  
> }
> 
> BTW, all of my mappings are defined (specifically mytype.location is  
> geo\_point), and this query works if I remove the \_geo\_distance sorting.
> 
> Kind regards
> 
> UPDATE (Mappings and Samples):
> 
> {  
> "template": "myidx",  
> "mytype": {  
> "dynamic": "strict",  
> "properties": {  
> "id": {"type": "long"},  
> "timestamp": {  
> "type": "date",  
> "format": "date\_time"  
> },  
> "location": {"type": "geo\_point"},  
> "user": {  
> "type": "string",  
> "index": "not\_analyzed"  
> },  
> "text": {  
> "type": "string",  
> "analyzer": "simple"  
> },  
> "to": {  
> "type": "string",  
> "index": "not\_analyzed"  
> },  
> "invisible": {"type": "boolean"},  
> "blocked": {"type": "boolean"}  
> }  
> }  
> }  
> }
> 
> {  
> "id":"1",  
> "timestamp":"2014-08-07T20:35:40.936Z",  
> "location":"10.0,10.0",  
> "user":"@geeko",  
> "text":"Hello World!",  
> "to":"WORLD",  
> "invisible":false,  
> "blocked":false  
> }
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/5f16b56a-9a18-4924-bf50-9b9531431078%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5f16b56a-9a18-4924-bf50-9b9531431078%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:10am UTC](https://discuss.elastic.co/t/elasticsearch--geo-distance-sorting-error/19155/4 "2017-07-06T01:10:03Z")

</div>


