Newbie questions on mapping

I just started to investigate Elasticsearch since my company uses it. I took a section of a mapping and used it to create a new index on a new ES instance and don't understand what happened.

The mapping has a dynamic template defined in it that is an array of items, including entries with path_match statements. But when I query for the mapping after posting it, what is returned is a non-array dynamic_template and the paths (regex) looked like "itemName\...+" don't even show up when I get the mapping.

So what is happening here? What kind of transformation took place? Where did the path_match text go to?

Thanks.

Les

Can you show the template as well as resulting mapping?

Since I can't post the full response, I've posted the initial part:

What was POSTed to create the index mapping:

{
"properties": {
"createdDate": {
"type": "date",
"index": false
}
},
"dynamic_templates": [
{
"period": {
"path_match": "period\..+",
"match_mapping_type": "string",
"match_pattern": "regex",
"mapping": {
"index": true,
"type": "keyword"
}
}
},
{
"groupingUnit": {
"path_match": "groupingUnit\..+",
"match_mapping_type": "string",
"match_pattern": "regex",
"mapping": {
"fields": {
"_search": {
"search_analyzer": "simple_string_search",
"analyzer": "simple_string_index",
"type": "text"
}
},
"index": true,
"type": "keyword"
}
}
},
{
"formElement": {
"path_match": "formElement\..+",
"match_mapping_type": "string",
"match_pattern": "regex",
"mapping": {
"index": false,
"type": "keyword"
}
}
},
{
"formName": {
"path_match": "formName\..+",
"match_mapping_type": "string",
"match_pattern": "regex",
"mapping": {
"fields": {
"_search": {
"search_analyzer": "simple_string_search",
"analyzer": "simple_string_index",
"type": "text"
}
},
"index": true,
"type": "keyword"
}
}
},
{
"document": {
"path_match": "document\..+",
"match_mapping_type": "string",
"match_pattern": "regex",
"mapping": {
"index": true,
"type": "keyword"
}
}
},
{
"groupingUnit": {
"properties": {
"identifier": {
"properties": {
"type": {
"type": "keyword",
"fields": {
"_search": {
"type": "text",
"analyzer": "simple_string_index",
"search_analyzer": "simple_string_search"
}
}
},
"value": {
"type": "keyword",
"fields": {
"_search": {
"type": "text",
"analyzer": "simple_string_index",
"search_analyzer": "simple_string_search"
}
}
}
}
},
"name": {
"type": "keyword",
"fields": {
"_search": {
"type": "text",
"analyzer": "simple_string_index",
"search_analyzer": "simple_string_search"
}
}
},
"role": {
"type": "keyword",
"fields": {
"_search": {
"type": "text",
"analyzer": "simple_string_index",
"search_analyzer": "simple_string_search"
}
}
}
}
}
}
]
}

This is the output from a GET _mapping:

{
"my_index": {
"mappings": {
"properties": {
"dynamic_templates": {
"properties": {
"document": {
"properties": {
"mapping": {
"properties": {
"index": {
"type": "boolean"
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"match_mapping_type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"match_pattern": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"path_match": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},

Discovered that the issue was related more to a bad mapping. By rebuilding it a piece at a time, I was able to clean things up and the expected response was presented.

Les

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