How to create mapping for index names begin with?

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?

@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

1 Like

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