我编写了以下查询,首先按最近的用户排序,然后按其余用户排序,但是当我在kibana上运行此查询时,它抛出一个 exception ,我不知道这是什么错误是吗?
查询
{
"query": {
"bool": {
"must": [
{
"term": {
"type": "user"
}
}
],
"filter": {
"geo_distance": {
"distance": "1000km",
"location": {
"lat": 24.71532,
"lon": 46.66479
}
}
}
},
"sort": [
{
"_geo_distance": {
"location": {
"lat": 24.71532,
"lon": 46.66479
},
"order": "asc",
"unit": "km",
"distance_type": "plane"
}
}
]
}
}
Exception
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 21,
"col": 5
}
],
"type": "parsing_exception",
"reason": "[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 21,
"col": 5
},
"status": 400
}
我在弹性搜索官方网站上找到了此代码。当我在不使用排序过滤器的情况下运行此查询时,此查询有效,但是当我添加排序过滤器U时会出现异常。
请指导我解决此查询问题。
答案 0 :(得分:1)
if(!user_data[uid]) user_data[uid] = {}
user_data[uid][data_name] = data
部分需要与try{user_data[uid][data_name] = data}
catch(e) {user_data[uid] = {}; writeData(uid, data_name, data)}
部分处于同一级别,而不是位于其中:
android.app.RemoteServiceException:
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1867)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6753)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)