Lowercase normalizer not working

HI, m trying to do exact search , with case insensitve.
I am able to exact search using "keyword" ,but even after adding normalizer. It does not work with case insenisitve.i have to give exact term to search.

.Match(m => m.Field(f => f.fieldNmae.Suffix("keyword")).Query(filterText)));

and found few document saying to add normalizer while creating index.
so i deleted the index and recreated with normalizer like below

.Settings(s => s.Analysis(a => a.Normalizers(n => n.Custom("my_lowercase", f => f.Filters("lowercase")))))
                    .Map<ObjectType>(l => l.AutoMap()
                        .Properties(p => p.Keyword(k => k.Name(n => n.fieldName).Normalizer("my_lowercase")))
                     

Can anyone tell me , what mistake i am making here ?

Thanks in advance

What is the mapping for the field in Elasticsearch?

is this what you are asking ?

Query<ObjectType>
                                .Match(m => m.Field(f => f.fieldName.Suffix("keyword")).Query(filterText)));

No. Retrieve the mapping for the field using the get mapping API.

 "fieldName
":{
                  "analyzer":null,
                  "boost":null,
                  "eagerGlobalOrdinals":null,
                  "fielddata":null,
                  "fielddataFrequencyFilter":null,
                  "index":null,
                  "indexOptions":null,
                  "indexPhrases":null,
                  "indexPrefixes":null,
                  "norms":null,
                  "positionIncrementGap":null,
                  "searchAnalyzer":null,
                  "searchQuoteAnalyzer":null,
                  "termVector":null,
                  "copyTo":null,
                  "fields":{
                     "keyword":{
                        "boost":null,
                        "eagerGlobalOrdinals":null,
                        "ignoreAbove":256,
                        "index":null,
                        "indexOptions":null,
                        "normalizer":null,
                        "norms":null,
                        "nullValue":null,
                        "splitQueriesOnWhitespace":null,
                        "docValues":null,
                        "copyTo":null,
                        "fields":null,
                        "similarity":null,
                        "store":null,
                        "meta":null
                     }
                  },

normalizer showing null even though have applied it

.Map(m => m.DynamicTemplates(dt => dt.DynamicTemplate("string_to_keyword", t => t
                                .MatchMappingType("string")
                                .Mapping(map => map.Text(tx => tx.Fields(f => f.Keyword(k => k.Name("keyword").Normalizer("lowercase"))))))))

using this one worked for me

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.