2012-12-08 47 views
0

我使用elasticsearch與Ruby on Rails的輪胎寶石。ElasticSearch /輪胎與rails:沒有解析器的元素

到目前爲止好,我有一個成功的範圍方面的日期,但現在我試圖做一樣的浮動字段,它給了我'沒有解析器的元素'錯誤。

mapping 
    indexes :budget, type: 'float' 
    indexes :post_date, type: 'date' 
end 

(隱藏其他字段)

在我的搜索

tire.search(load: true, page: params[:page], per_page: 8) do 
    query do 
    boolean do 
     must { string params[:query], default_operator: "AND" } if params[:query].present? 
    end 
    facet('timeline') { range :post_date, { :ranges => [ { to: Date.today+1, from: Date.today-7 }, { to: Date.today+1, from: Date.today-14 }, { to: Date.today+1, from: Date.today-30 } ] } } 
    facet('budget') { range :budget, {:ranges => [{ to: 500 }, { from: 500, to: 1000 },{ from: 1000, to: 1500 },{ from: 1500 }]}} 
    end 
end 

一個正常工作的時間表,我已經重新索引=(力=真)

我得到這個錯誤:(類似的錯誤重複了幾次)

500 : {"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[8B30I3dRQ6elhGcF6El0lw][projects][1]: SearchParseException[[projects][1]: query[(status:posted status:awarded status:closed)~1],from[-1],size[-1],sort[<custom:\"display_type\": o[email protected]618faee9>!,<custom:\"post_date\": [email protected]691da>]: Parse Failure [Failed to parse source [{\"query\":{\"bool\":{\"must\":[{\"terms\":{\"status\":[\"posted\",\"awarded\",\"closed\"]}}]}},\"sort\":[{\"display_type\":\"desc\"},\"post_date\"],\"facets\":{\"status\":{\"terms\":{\"field\":\"status\",\"size\":10,\"all_terms\":false}},\"industry_finance\":{\"terms\":{\"field\":\"finance\",\"size\":10,\"all_terms\":false}},\"industry_law\":{\"terms\":{\"field\":\"law\",\"size\":10,\"all_terms\":false}},\"industry_consulting\":{\"terms\":{\"field\":\"consulting\",\"size\":10,\"all_terms\":false}},\"expertise\":{\"terms\":{\"field\":\"expertise\",\"size\":25,\"all_terms\":false}},\"skills\":{\"terms\":{\"field\":\"skills\",\"size\":25,\"all_terms\":false}},\"country\":{\"terms\":{\"field\":\"geo\",\"size\":10,\"all_terms\":false}},\"language\":{\"terms\":{\"field\":\"language\",\"size\":10,\"all_terms\":false}},\"location\":{\"terms\":{\"field\":\"location\",\"size\":10,\"all_terms\":false}},\"timeline\":{\"range\":{\"field\":\"post_date\",\"ranges\":{\"ranges\":[{\"to\":\"2012-12-09\",\"from\":\"2012-12-01\"},{\"to\":\"2012-12-09\",\"from\":\"2012-11-24\"},{\"to\":\"2012-12-09\",\"from\":\"2012-11-08\"}]}}},\"budget\":{\"range\":{\"field\":\"budget\",\"ranges\":{\"ranges\":[{\"to\":500},{\"from\":500,\"to\":1000},{\"from\":1000,\"to\":1500},{\"from\":1500}]}}}},\"size\":8}]]]; nested: SearchParseException[[projects][1]: query[(status:posted status:awarded status:closed)~1],from[-1],size[-1],sort[<custom:\"display_type\": o[email protected]618faee9>!,<custom:\"post_date\": [email protected]691da>]: Parse Failure [No parser for element [budget]]] 

相關位似乎是:解析失敗[元素[預算]沒有解析器]
不知道是什麼原因造成這一點,任何輸入非常感謝! 謝謝

+0

更奇怪的是,如果我走了「時間表」方面出它工作正常;兩者將分開工作,但不能連在一起。我錯過了什麼/? – bobomoreno

+0

對不起,這裏沒有聰明的想法...也許,你可以嘗試將日期序列化爲一個字符串,所以Ruby方面沒有混亂嗎?另外,你可以啓用日誌記錄並使用'curl'來嘗試請求嗎? – karmi

回答

0

我認爲你應該重新索引你想使用的索引。例如,對於文章類:

耙RAILS_ENV =生產輪胎:進口CLASS =文章FORCE =真

相關問題