{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/10038","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10038/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10038/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10038/events","html_url":"https://github.com/elastic/elasticsearch/issues/10038","id":60310803,"number":10038,"title":"Failure to create Filtered Alias on empty index with template mappings","user":{"login":"andersosthus","id":184104,"avatar_url":"https://avatars.githubusercontent.com/u/184104?v=3","gravatar_id":"","url":"https://api.github.com/users/andersosthus","html_url":"https://github.com/andersosthus","followers_url":"https://api.github.com/users/andersosthus/followers","following_url":"https://api.github.com/users/andersosthus/following{/other_user}","gists_url":"https://api.github.com/users/andersosthus/gists{/gist_id}","starred_url":"https://api.github.com/users/andersosthus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersosthus/subscriptions","organizations_url":"https://api.github.com/users/andersosthus/orgs","repos_url":"https://api.github.com/users/andersosthus/repos","events_url":"https://api.github.com/users/andersosthus/events{/privacy}","received_events_url":"https://api.github.com/users/andersosthus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Aliases","name":":Aliases","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/doc","name":"doc","color":"b3694f"}],"state":"open","locked":false,"assignee":{"login":"javanna","id":832460,"avatar_url":"https://avatars.githubusercontent.com/u/832460?v=3","gravatar_id":"","url":"https://api.github.com/users/javanna","html_url":"https://github.com/javanna","followers_url":"https://api.github.com/users/javanna/followers","following_url":"https://api.github.com/users/javanna/following{/other_user}","gists_url":"https://api.github.com/users/javanna/gists{/gist_id}","starred_url":"https://api.github.com/users/javanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javanna/subscriptions","organizations_url":"https://api.github.com/users/javanna/orgs","repos_url":"https://api.github.com/users/javanna/repos","events_url":"https://api.github.com/users/javanna/events{/privacy}","received_events_url":"https://api.github.com/users/javanna/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-03-09T08:15:02Z","updated_at":"2015-03-17T17:27:58Z","closed_at":null,"body":"Hi,\r\n\r\nES 1.4.x gives the error ```[repro] Strict field resolution and no field mapping can be found for the field with name [testfield]``` when I try to create an alias on an empty Index that has template mappings.\r\nThis works fine in ES 1.3.x.\r\n\r\nI see in the guide (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html#filtered) that in 1.4.0.beta1 there was added a clause stating that the field has to exist in the mapping, but it does not mention anything about mapping in templates - so I'm not sure if this is a documentation bug or and ES bug.\r\n\r\nRepro case:\r\n```\r\ncurl -XPUT 'http://localhost:9200/_template/repro' -d '{\r\n  \"template\": \"repro\",\r\n  \"settings\": {\r\n    \"index.number_of_shards\": 1,\r\n    \"index.number_of_replicas\": 0\r\n  },\r\n  \"mappings\": {\r\n    \"_default_\": {\r\n      \"properties\": {\r\n        \"testfield\": {\r\n          \"type\": \"string\",\r\n          \"index\": \"not_analyzed\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n}'\r\n```\r\n\r\n```\r\ncurl -XPOST 'http://localhost:9200/repro'\r\n```\r\n\r\n```\r\ncurl -XPOST  'http://localhost:9200/_aliases' -d '{\r\n   \"actions\": [\r\n      {\r\n         \"add\": {\r\n            \"index\": \"repro\",\r\n            \"alias\": \"testalias\",\r\n            \"filter\": {\r\n               \"term\": {\r\n                  \"testfield\": \"filtervalue\"\r\n               }\r\n            }\r\n         }\r\n      }\r\n   ]\r\n}'\r\n```"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/82489404","html_url":"https://github.com/elastic/elasticsearch/issues/10038#issuecomment-82489404","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10038","id":82489404,"user":{"login":"javanna","id":832460,"avatar_url":"https://avatars.githubusercontent.com/u/832460?v=3","gravatar_id":"","url":"https://api.github.com/users/javanna","html_url":"https://github.com/javanna","followers_url":"https://api.github.com/users/javanna/followers","following_url":"https://api.github.com/users/javanna/following{/other_user}","gists_url":"https://api.github.com/users/javanna/gists{/gist_id}","starred_url":"https://api.github.com/users/javanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javanna/subscriptions","organizations_url":"https://api.github.com/users/javanna/orgs","repos_url":"https://api.github.com/users/javanna/repos","events_url":"https://api.github.com/users/javanna/events{/privacy}","received_events_url":"https://api.github.com/users/javanna/received_events","type":"User","site_admin":false},"created_at":"2015-03-17T17:27:58Z","updated_at":"2015-03-17T17:27:58Z","body":"I am marking this issue for discussion. I do see your point @shivangshah , I am just not sure how we can get there. The feature you are requesting turns around the `_default_` mapping as we would need to  lock down the mappings for those fields and make sure that the parsed filter is always consistent with the actual mapping for the field. That would mean that instead of a fallback mechanism we would need to be able to force certain mappings for all of the types."}}