Hi all!
I want to use my custom analyzer (autocomplete -- below) on a number field that I have indexed as shown below. I am using Ruby on Rails Elasticsearch version.
settings index: {
analysis: {
filter: {
autocomplete: {
type: :edge_ngram,
min_gram: 1,
max_gram: 10,
}
},
analyzer: {
autocomplete: {
type: :custom,
tokenizer: :standard,
filter: %i[lowercase autocomplete]
}
}
}
}
do
mappings dynamic: false do
indexes :model, type: :text do
indexes :model, type: :text, analyzer: :autocomplete
indexes :model, type: :text, search_analyzer: :standard
end
indexes :mpg, type: :text, analyzer: :english
end
end
Now what I want to do is as the user types in the range of MPG they want in the search bar (have 2 fields -- so like 10 - 20 MPG), I want the autocomplete to be returning numbers automatically like my model field (i.e. 2 digits i.e. 7, 79, 80, 81 etc). However, I don't know if I can do this 3 analyzers on my MPG field? And if so, I don't know if a range can be specified on a field with a custom analyzer using edge_ngrams? Any direction would be great.