I have been experimenting with elasticsearch lately with ruby on rails. I am having trouble getting my data indexed so I can search for items with both plural, and non-plur
It's easiest to set this in the elasticsearch.yml settings file:
index.number_of_shards: 2
index.number_of_replicas: 0
index.analysis.analyzer.default.type: snowball
It's possible to change default analyzer using index settings:
require 'rubygems'
require 'tire'
Tire.index 'articles' do
delete
create :settings => {
:index => {
:analysis => {
:analyzer => {
:default => {
:type => 'snowball'
}
}
}
}
},
:mappings => {
:article => {
:properties => {
:title => { :type => 'string', :analyzer => 'snowball'},
:body => { :type => 'string', :analyzer => 'snowball'}
}
}
}
store :title => 'Tests', :body => "Plural"
store :title => 'Test', :body => "Singular"
refresh
end