1
我正試圖在我的rails應用程序中使用Tire實現ElasticSearch。我做了一個非常基本的設置:輪胎::搜索:: SearchRequest關於utf8的錯誤信息關於utf8的錯誤
country.rb
class Country < ActiveRecord::Base
attr_accessible :name
include Tire::Model::Search
include Tire::Model::Callbacks
end
home.html.erb
<%= form_tag '/pages/search', :method => 'get' do %>
<p>
<%= text_field_tag :query, params[:query] %>
<%= submit_tag "Search", name: nil %>
</p>
<% end %>
pages_controller.rb
class PagesController < ApplicationController
def search
@countries = Country.search(params)
end
end
和我得到一個錯誤說:
400 : {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[wy5c-7SwS2q0fXPjUg0gYg][countries][3]: SearchParseException[[countries][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"query_string\":{\"query\":{\"utf8\":\"\\u2713\",\"query\":\"C\",\"controller\":\"pages\",\"action\":\"search\"}}},\"size\":10}]]]; nested: QueryParsingException[[countries] [query_string] query does not support [utf8]]; }{[wy5c-7SwS2q0fXPjUg0gYg][countries][2]: SearchParseException[[countries][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"query_string\":{\"query\":{\"utf8\":\"\\u2713\",\"query\":\"C\",\"controller\":\"pages\",\"action\":\"search\"}}},\"size\":10}]]]; nested: QueryParsingException[[countries] [query_string] query does not support [utf8]]; }{[wy5c-7SwS2q0fXPjUg0gYg][countries][1]: SearchParseException[[countries][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"query_string\":{\"query\":{\"utf8\":\"\\u2713\",\"query\":\"C\",\"controller\":\"pages\",\"action\":\"search\"}}},\"size\":10}]]]; nested: QueryParsingException[[countries] [query_string] query does not support [utf8]]; }{[wy5c-7SwS2q0fXPjUg0gYg][countries][0]: SearchParseException[[countries][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"query_string\":{\"query\":{\"utf8\":\"\\u2713\",\"query\":\"C\",\"controller\":\"pages\",\"action\":\"search\"}}},\"size\":10}]]]; nested: QueryParsingException[[countries] [query_string] query does not support [utf8]]; }{[wy5c-7SwS2q0fXPjUg0gYg][countries][4]: SearchParseException[[countries][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"query_string\":{\"query\":{\"utf8\":\"\\u2713\",\"query\":\"C\",\"controller\":\"pages\",\"action\":\"search\"}}},\"size\":10}]]]; nested: QueryParsingException[[countries] [query_string] query does not support [utf8]]; }]","status":400}
有人能看到什麼,我在這裏失蹤?非常感謝所有幫手!
作品!謝謝。這太快了,甚至無法接受另外4分鐘的答案:-) –