{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/21202","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21202/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21202/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21202/events","html_url":"https://github.com/elastic/elasticsearch/issues/21202","id":186295416,"number":21202,"title":"Storing search templates in cluster state - broken docs or code?","user":{"login":"markharwood","id":170925,"avatar_url":"https://avatars.githubusercontent.com/u/170925?v=3","gravatar_id":"","url":"https://api.github.com/users/markharwood","html_url":"https://github.com/markharwood","followers_url":"https://api.github.com/users/markharwood/followers","following_url":"https://api.github.com/users/markharwood/following{/other_user}","gists_url":"https://api.github.com/users/markharwood/gists{/gist_id}","starred_url":"https://api.github.com/users/markharwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markharwood/subscriptions","organizations_url":"https://api.github.com/users/markharwood/orgs","repos_url":"https://api.github.com/users/markharwood/repos","events_url":"https://api.github.com/users/markharwood/events{/privacy}","received_events_url":"https://api.github.com/users/markharwood/received_events","type":"User","site_admin":false},"labels":[{"id":334286612,"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v6.0.0","name":"v6.0.0","color":"dddddd","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-31T14:21:11Z","updated_at":"2016-10-31T18:07:30Z","closed_at":null,"body":"Trying the advice from [our latest docs](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-template.html#pre-registered-templates) where we can store search templates using this command: \r\n\r\n    POST /_search/template/<templatename>\r\n\r\nthis produces this error on the latest master \r\n\r\n\t{\r\n\t   \"error\": {\r\n\t\t  \"root_cause\": [\r\n\t\t\t {\r\n\t\t\t\t\"type\": \"invalid_index_name_exception\",\r\n\t\t\t\t\"reason\": \"Invalid index name [_search], must not start with '_', '-', or '+'\",\r\n\t\t\t\t\"index_uuid\": \"_na_\",\r\n\t\t\t\t\"index\": \"_search\"\r\n\t\t\t }\r\n\t\t  ],\r\n\t\t  \"type\": \"invalid_index_name_exception\",\r\n\t\t  \"reason\": \"Invalid index name [_search], must not start with '_', '-', or '+'\",\r\n\t\t  \"index_uuid\": \"_na_\",\r\n\t\t  \"index\": \"_search\"\r\n\t   },\r\n\t   \"status\": 400\r\n\t}\r\n\r\nEither we have a bug or the docs haven't been updated with changes to the code. This command works OK in 5.0\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/257372592","html_url":"https://github.com/elastic/elasticsearch/issues/21202#issuecomment-257372592","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21202","id":257372592,"user":{"login":"markharwood","id":170925,"avatar_url":"https://avatars.githubusercontent.com/u/170925?v=3","gravatar_id":"","url":"https://api.github.com/users/markharwood","html_url":"https://github.com/markharwood","followers_url":"https://api.github.com/users/markharwood/followers","following_url":"https://api.github.com/users/markharwood/following{/other_user}","gists_url":"https://api.github.com/users/markharwood/gists{/gist_id}","starred_url":"https://api.github.com/users/markharwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markharwood/subscriptions","organizations_url":"https://api.github.com/users/markharwood/orgs","repos_url":"https://api.github.com/users/markharwood/repos","events_url":"https://api.github.com/users/markharwood/events{/privacy}","received_events_url":"https://api.github.com/users/markharwood/received_events","type":"User","site_admin":false},"created_at":"2016-10-31T18:07:30Z","updated_at":"2016-10-31T18:07:30Z","body":">And it works fine, what request are you trying?\r\n\r\nRunning master as of this morning but running inside eclipse so that may be relevant:  with xpack, security and monitoring disabled.\r\n\r\n\tPOST /_search/template/mytemplate \r\n\t{\r\n\t\t\"template\":{\r\n\t\t  \"query\": {\r\n\t\t\t \"bool\": {\r\n\t\t\t\t\"must\": [\r\n\t\t\t\t   {\r\n\t\t\t\t\t  \"term\": {\r\n\t\t\t\t\t\t \"myField\": \"{{post}}\"\r\n\t\t\t\t\t  }\r\n\t\t\t\t   }\r\n\t\t\t\t]\r\n\t\t\t }\r\n\t\t  }\r\n\t\t}\r\n\t}"}}
{"actor":{"display_login":"markharwood"}}