I'm trying to index data with the following mapping:
{
"settings": {
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [],
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"dynamic": "strict",
"dynamic_templates": [
{
"contact_template_name": {
"path_match": "contact.*.name",
"mapping": {
"type": "text",
"similarity": "BM25",
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 1024
},
"raw_lc": {
"type": "keyword",
"ignore_above": 1024,
"normalizer": "lowercase_normalizer"
}
}
}
}
},
{
"contact_template_app": {
"path_match": "contact.*.app",
"mapping": {
"type": "keyword",
"ignore_above": 1024
}
}
},
{
"contact_template_id": {
"path_match": "contact.*.id",
"mapping": {
"type": "long"
}
}
}
],
"properties": {
"contact": {
"type": "object",
"properties": {}
}
}
}
}
And trying to index following document.
{
"contact": {
"europa243k": [
{
"name": "block",
"app": "ss2",
"id": "1220"
}
],
"nyrosx4": [
{
"name": "oqpe",
"app": "xy",
"id": "218588"
}
],
"pkoris": [
{
"name": "tepo",
"app": "nyto",
"id": "218595"
}
]
}
}
But I'm getting this error:
{
"error": {
"root_cause": [
{
"type": "strict_dynamic_mapping_exception",
"reason": "[3:23] mapping set to strict, dynamic introduction of [europa243k] within [contact] is not allowed"
}
],
"type": "strict_dynamic_mapping_exception",
"reason": "[3:23] mapping set to strict, dynamic introduction of [europa243k] within [contact] is not allowed"
},
"status": 400
}
I want to maintain this strict mode: "dynamic": "strict"