My goal is to search a word irrespective of the analyzer added to that.
I used match query with keyword analyzer but i think it works with the default analyzer added to that property.
In elastic search, my author document structure is like
"_source": {
"Id": 3,
"Organization": "let123"
}
Index mapping :
createIndexDescriptor.NumberOfReplicas(1)
.NumberOfShards(1)
.Settings(
settings =>
settings
.Add("analysis.filter.autocomplete_filter_ngram.type", "edge_ngram")
.Add("analysis.filter.autocomplete_filter_ngram.min_gram", "2")
.Add("analysis.filter.autocomplete_filter_ngram.max_gram", "7")
.Add("analysis.analyzer.title_analyzer.type", "custom")
.Add("analysis.analyzer.title_analyzer.char_filter.0", "html_strip")
.Add("analysis.analyzer.title_analyzer.tokenizer", "standard")
.Add("analysis.analyzer.title_analyzer.filter.0", "lowercase")
.Add("analysis.analyzer.title_analyzer.filter.1", "asciifolding")
.Add("analysis.analyzer.title_analyzer.filter.2", "autocomplete_filter_ngram"))
.AddMapping<Author>(
m =>
m.MapFromAttributes()
.AllField(f => f.Enabled(true))
.Properties(
props =>
props.MultiField(
mf =>
mf.Name(t => t.Organization)
.Fields(fs => fs.String(s => s.Name(t => t.Organization).Analyzer("title_analyzer"))
))));
here i noted one of my title analyzer filter is ngram
But I used keyword analyzer in my match query to avoid autocomplete in my searching.
GET /author/_search {
"query": {
"match": {
"Organization": {
"query": "le",
"analyzer": "keyword"
}
}
} }
But when i searched, the above document is matched. what i am expecting is Organization having exact value as 'le'
Why this is matched? Any idea to achieve my goal?