Sorting Elasticsearch\u geo\u距离排序错误
向飞越者致意 为什么elasticsearch 1.2.2使用官方的nodejs客户端会出现此错误Sorting Elasticsearch\u geo\u距离排序错误,sorting,geolocation,
elasticsearch,Sorting,Geolocation,
elasticsearch,向飞越者致意 为什么elasticsearch 1.2.2使用官方的nodejs客户端会出现此错误 Parse Failure [No mapping found for [[object Object]] in order to sort on]] "sort":[{"_score":{}},{"[object Object]":{}}] 以下是我的JSON格式查询: { "index":"myidx", "type":"mytype", "body":{
Parse Failure [No mapping found for [[object Object]] in order to sort on]]
"sort":[{"_score":{}},{"[object Object]":{}}]
以下是我的JSON格式查询:
{
"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
}
顺便说一句,我所有的映射都是专门为mytype定义的。location是geo_point,如果我删除了_geo_距离排序,这个查询就会工作
问候
更新映射和示例:
{
"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
}
实际上,这是因为我不正确地使用了nodejs客户端。
我使用了客户端搜索功能提供的排序属性,这相当于url排序,它不接受像_geo_distance这样的对象,我本应该在查询体中使用排序属性。这对我有用。我能分类,你能给我一个卷发要求吗?因为我不能在拥有映射和数据之后进行复制。你确定在插入任何数据之前定义了映射吗?是的,因为如果我删除_geo_distance排序,其他类型的排序都可以正常工作。它与您一起工作吗?您能否提供用于解决问题的工作代码?谢谢。只要把尸体移到库里旁边就行了