Elasticsearch _geo_distance Sorting Error

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wondering if it works if you remove mytype.

{"_geo_distance":{"location":"0.0,0.0"}}

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

Le 8 août 2014 à 06:02, Mohannad Saeed 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b09ee211-2a17-4829-84a7-996aa11bd1ca%40googlegroups.com.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7D44B8B8-DD0D-4858-8872-D980CD5CBF7D%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Hi David,

Tried it, not working for me :frowning:

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 :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 août 2014 à 06:02, Mohannad Saeed <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 <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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5f16b56a-9a18-4924-bf50-9b9531431078%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.