无论才能、知识多么卓著,如果缺乏热情,则无异纸上画饼充饥,无补于事。

基于多字段,时间范围过滤的地理位置搜索问题

Elasticsearch | 作者 zhangxiaoling | 发布于2017年09月12日 | 阅读数:2828

搜索需求是:
     筛选出:feed_status=1,sex=1,create_time为一天前,经纬度为指定经纬度的记录。
    
    
QQ图片20170912151959.png

 
搜索query为:
  
  {
"query": {
"bool": {
"must": [
{
"term": {
"feed_status": 0
}
},
{
"terms": {
"sex": [
1,
2
]
}
},
{
"range": {
"create_time": {
"gte": "now-1h"
}
}
}
]
},
"_source": {
"include": [
"feed_id",
"city",
"view_times",
"like_num",
"exposure",
"sex",
"uid",
"has_face",
"create_time",
"feed_status"
]
},
"from": 0,
"size": 5,
"sort": [
{
"_geo_distance": {
"location": {
"lat": 30.67,
"lon": 104.06
},
"order": "asc",
"unit": "km",
"distance_type": "plane"
}
}
]
}
}

 
但是始终报:

 
{

"error": {
"root_cause": [
{
"type": "parse_exception",
"reason": "failed to parse search source. expected field name but got [START_OBJECT]"}],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "feeds_nearby",
"node": "GAn6WDVCQJKnocLFgVLBfw",
"reason": {
"type": "parse_exception",
"reason": "failed to parse search source. expected field name but got [START_OBJECT]"}}]},
"status": 400}
   还望各位大神指教!
 
 
已邀请:

要回复问题请先登录注册