我正在使用rails 5.0.0.1,elasticsearch-model,elasticsearch-rails和搜索某些记录对整个世界和部分正常工作,但对于其他记录不完全有效。 ES版本2.3.1。 我的location.rb:
require 'elasticsearch/model'
class Location < ActiveRecord::Base
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
settings analysis: { filter: {
ngram_filter: { type: "nGram", min_gram: 2, max_gram: 12 } }, analyzer: {
index_ngram_analyzer: {
type: 'custom',
tokenizer: 'standard',
filter: ['lowercase', 'ngram_filter']
},
search_ngram_analyzer: {
type: 'custom',
tokenizer: 'standard',
filter: ['lowercase']
}
} } do
mapping do
indexes :location, :type => "string", analyzer: "index_ngram_analyzer", search_analyzer: "search_ngram_analyzer"
indexes :address, :type => "string", analyzer: "index_ngram_analyzer", search_analyzer: "search_ngram_analyzer"
end
end
http://localhost:9200/locations/_count return {“count”:12463,“_ shards”:{“total”:5,“success”:5,“failed”:0}},表示所有位置都已编入索引。< / p>
请帮忙 - 我做错了什么?