# Match\_pattern mapping doesn't work

**URL:** <https://discuss.elastic.co/t/match-pattern-mapping-doesnt-work/136054>\
**Category:** Elasticsearch\
**Created:** [June 15, 2018, 8:53am UTC](https://discuss.elastic.co/t/match-pattern-mapping-doesnt-work/136054 "2018-06-15T08:53:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gourmax](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gourmax](https://discuss.elastic.co/u/gourmax)\
**Post date:** [June 15, 2018, 8:53am UTC](https://discuss.elastic.co/t/match-pattern-mapping-doesnt-work/136054/1 "2018-06-15T08:53:02Z")

</div>

I'm trying to create a template to map my futur indices.  
The following match work fine:

```
"mappings": {
"doc": {
  "properties": {
    "@version": {
      "enabled": false
    },
    "tags": {
        "enabled": false
    }
  },
  "dynamic_templates": [
    {
      "number_template": {
        "match": "A*",
        "mapping": {
          "type": "float"
        }
      }
    }
  ]
}
}

```

But I want more field starting with other letter so I try to use the "match\_pattern" with "regex".

```
"mappings": {
"doc": {
  "properties": {
    "@version": {
      "enabled": false
    },
    "tags": {
        "enabled": false
    }
  },
  "dynamic_templates": [
    {
      "number_template": {
        "match_pattern": "regex",
        "match": "A*",
        "mapping": {
          "type": "float"
        }
      }
    }
  ]
}
}

```

But it doesn't work. I would like something like this "[AT]\*", but it seems that there is something wrong somewhere.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 13, 2018, 8:53am UTC](https://discuss.elastic.co/t/match-pattern-mapping-doesnt-work/136054/2 "2018-07-13T08:53:12Z")

</div>

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