My data is dynamic, some fileds have incorrect values, when i index/insert first time data below
// other attributes....
"my_key-sp1": [
{
"locale": null,
"scope": null,
"data": "60"
}
],
// other attributes....
data is parsed as long datatype other product may have incorrect value like below
// other attributes....
"my_key-sp1": [
{
"locale": null,
"scope": null,
"data": "60/ep"
}
],
// other attributes....
now as you know this is incorrect value to store in the index
i tried to diable numeric detection, maybe let me store all long as text/string
`
var createIndexResponse = client.Indices.Create("my_index", c => c
.Map(m => m
.NumericDetection(false)
)
);
` and i think this is the right solution
var createIndexResponse = client.Indices.Create("my_index", c => c
.Map(m => m
.DynamicTemplates(dt => dt
.DynamicTemplate("longs_as_strings", d => d
.MatchMappingType("string")
.Match("long_*")
.Unmatch("*_text")
.Mapping(mm => mm
.Number(n => n
.Type(NumberType.Long)
)
)
)
)
)
);
I think with the new client i can do this by following
var createIndexResponse = elasticsearchClient.Indices.Create("my_index",c=>c.Mappings(m=>m.DynamicTemplates(HOW_To_USE_PARAMS_HERE))
but not sure how to use it
Got a solution guys, sharing so it can help others, so 1 way around is I can add template for my index where i can set this rule query