Hello,
I would like to create dynamic mapping so that all strings matching IP address pattern are mapped to IP type and all other strings are mapped to keyword/text.
I've tried the following index template, but it does not seem to catch IP addresses.
{
"aliases": {},
"mappings": {
"doc": {
"_all": {
"enabled": false
},
"dynamic_templates": [
{
"strings": {
"mapping": {
"type": "keyword",
"ignore_above": 256,
"fields": {
"raw": {
"type": "text"
}
}
},
"unmatch": "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
"match_pattern": "regex",
"match_mapping_type": "string"
}
},
{
"ip_address": {
"match_mapping_type": "string",
"match_pattern": "regex",
"match": "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
"mapping": {
"type": "ip"
}
}
}
],
"_source": {
"enabled": true
}
}
},
"settings": {
"index": {
"query": {
"default_field": "uri"
},
"number_of_replicas": "1",
"auto_expand_replicas": "false",
"translog": {
"durability": "async"
},
"number_of_shards": "8",
"refresh_interval": "60s"
}
},
"index_patterns": [
"haproxy-*"
],
"order": 100
}
I did not find any documentations/examples, so I would appreciate any help on this.
Also, is there a way to debug dynamic_template rules?
Thank you very much.