# How to create mapping for index names begin with?

**URL:** <https://discuss.elastic.co/t/how-to-create-mapping-for-index-names-begin-with/76363>\
**Category:** Elasticsearch\
**Created:** [February 24, 2017, 7:42am UTC](https://discuss.elastic.co/t/how-to-create-mapping-for-index-names-begin-with/76363 "2017-02-24T07:42:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 24, 2017, 7:42am UTC](https://discuss.elastic.co/t/how-to-create-mapping-for-index-names-begin-with/76363/1 "2017-02-24T07:42:27Z")

</div>

Hi,

I have made a mapping like below for my indices begin with `mylogs-`;

```
PUT mylogs-* 
{
  "mappings": {
	"logfile": { 
	  "_all": { "enabled": false }, 
		"properties" : {
		  "@timestamp" : {
			"type" : "date"
		  },
		  "@version" : {
			"type" : "integer"
		  },
		  "result" : {
			"type" : "integer"
		  }
		}
	}
  }
}

```

The indices will be look like `mylogs-2017-02-01`, `mylogs-2017-02-02` etc. In Kibana, when I try to execute this, I am getting the error;

```
{
  "error": {
	"root_cause": [
	  {
		"type": "invalid_index_name_exception",
		"reason": "Invalid index name [mylogs-*], must not contain the following characters [, \", *, \\, <, |, ,, >, /, ?]",
		"index_uuid": "_na_",
		"index": "mylogs-*"
	  }
	],
	"type": "invalid_index_name_exception",
	"reason": "Invalid index name [mylogs-*], must not contain the following characters [, \", *, \\, <, |, ,, >, /, ?]",
	"index_uuid": "_na_",
	"index": "mylogs-*"
  },
  "status": 400
}

```

How can I fix this?

---

<div class="post-metadata">

**Author:** ![avr](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@avr](https://discuss.elastic.co/u/avr)\
**Post date:** [February 24, 2017, 7:53am UTC](https://discuss.elastic.co/t/how-to-create-mapping-for-index-names-begin-with/76363/2 "2017-02-24T07:53:20Z")

</div>

@elasticcloud Index templates does that work for you. You have to create an index template with `"template":"mylogs-*"`.

Go through the following URL to read more about them!  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-templates.html#indices-templates](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-templates.html#indices-templates)

---

<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:** [March 24, 2017, 7:53am UTC](https://discuss.elastic.co/t/how-to-create-mapping-for-index-names-begin-with/76363/3 "2017-03-24T07:53:52Z")

</div>

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