Один из вариантов - использовать dynamici c template , который создаст сопоставление ключевых слов с указанным нормализатором для всех строк
var createIndexResponse = await client.Indices.CreateAsync("my_index", c => c
.Settings(s => s.Analysis(a => a
.Normalizers(n => n.Custom("lowercase", cn => cn.Filters("lowercase")))))
.Map(m => m.DynamicTemplates(dt => dt.DynamicTemplate("string_to_keyword", t => t
.MatchMappingType("string")
.Mapping(map => map.Keyword(k => k.Normalizer("lowercase")))))));
, проиндексировав этот документ
var indexDocumentAsync = await client.IndexDocumentAsync(new Document {Id = 1, Name = "name"});
создаст следующее отображение индекса
{
"my_index": {
"mappings": {
"dynamic_templates": [
{
"string_to_keyword": {
"match_mapping_type": "string",
"mapping": {
"normalizer": "lowercase",
"type": "keyword"
}
}
}
],
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "keyword",
"normalizer": "lowercase"
}
}
}
}
}
Надеюсь, это поможет.