2015-07-10 77 views
3

我運行Elasticsearch 1.5.2和嘗試以下查詢:「助推」不工作的「術語」查詢

{ 
    "query": { 
    "filtered": { 
     "filter": { 
     "bool": { 
      "must": [ 
      { 
       "term": { 
       "gender": "male" 
       } 
      } 
      ] 
     } 
     }, 
     "query": { 
     "bool": { 
      "must": [ 
      { 
       "match_all": {} 
      } 
      ], 
      "should": [ 
      { 
       "term": { 
       "top_users": 1, 
       "boost": 2 
       } 
      } 
      ] 
     } 
     } 
    } 
    } 
} 

一切都很好,直到我加入「提升」:2到應該 - >術語部分。完整的查詢要複雜得多,這就是爲什麼我需要提高,但剩餘的查詢不作任何區別:

QueryParsingException:如果長期查詢得到了升壓參數ES返回一個錯誤400 [[index_name] [_na]查詢格式不正確,必須以start_object開頭]

有何建議?

回答

2

它應該是like this

{ 
    "query": { 
    "filtered": { 
     "filter": { 
     "bool": { 
      "must": [ 
      { 
       "term": { 
       "gender": "male" 
       } 
      } 
      ] 
     } 
     }, 
     "query": { 
     "bool": { 
      "must": [ 
      { 
       "match_all": {} 
      } 
      ], 
      "should": [ 
      { 
       "term": { 
       "top_users": { 
        "value": "1", 
        "boost": 2 
       } 
       } 
      } 
      ] 
     } 
     } 
    } 
    } 
}