{"action":"opened","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/20886","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20886/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20886/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20886/events","html_url":"https://github.com/elastic/elasticsearch/issues/20886","id":182520253,"number":20886,"title":"Multiple mappings on a field does not work for nested docs","user":{"login":"pirovorster","id":6638988,"avatar_url":"https://avatars.githubusercontent.com/u/6638988?v=3","gravatar_id":"","url":"https://api.github.com/users/pirovorster","html_url":"https://github.com/pirovorster","followers_url":"https://api.github.com/users/pirovorster/followers","following_url":"https://api.github.com/users/pirovorster/following{/other_user}","gists_url":"https://api.github.com/users/pirovorster/gists{/gist_id}","starred_url":"https://api.github.com/users/pirovorster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pirovorster/subscriptions","organizations_url":"https://api.github.com/users/pirovorster/orgs","repos_url":"https://api.github.com/users/pirovorster/repos","events_url":"https://api.github.com/users/pirovorster/events{/privacy}","received_events_url":"https://api.github.com/users/pirovorster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-12T13:04:56Z","updated_at":"2016-10-12T13:04:56Z","closed_at":null,"body":"\r\n**Elasticsearch version**: 1.74\r\n\r\n**Plugins installed**: []\r\n\r\n**JVM version**: Found Hosting \r\n\r\n**OS version**: Found Hosting\r\n\r\nI followed https://www.elastic.co/guide/en/elasticsearch/guide/current/mixed-lang-fields.html to analyze fields multiple times. However it seems as if this feature does not work on nested documents.\r\n\r\nI added an index with the following mapping:\r\n```\r\n{\r\n  \"mappings\": {\r\n    \"case\": {\r\n      \"properties\": {\r\n        \"clientRelationship.policy.policyHolder.firstName\": {\r\n          \"type\": \"string\",\r\n          \"fields\": {\r\n            \"key\": {\r\n              \"type\": \"string\",\r\n              \"analyzer\": \"keyword\"\r\n            }\r\n          }\r\n        },\r\n        \"test\": {\r\n          \"type\": \"string\",\r\n          \"fields\": {\r\n            \"key\": {\r\n              \"type\": \"string\",\r\n              \"analyzer\": \"keyword\"\r\n            }\r\n          }\r\n        },\r\n        \"test2\": {\r\n          \"type\": \"string\",\r\n          \"analyzer\": \"keyword\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\nThen added a document:\r\n```\r\n{\r\n  \"clientRelationship\": {\r\n    \"policy\": {\r\n      \"policyHolder\": {\r\n        \"firstName\": \"Jeff Awesome\"\r\n      }\r\n    }\r\n  },\r\n  \"test\": \"Jeff Awesome\"\r\n}\r\n```\r\nWhen searching\r\n```\r\n{\r\n  \"query\": {\r\n    \"term\": {\r\n      \"test\": \"Jeff Awesome\"\r\n    }\r\n  }\r\n}\r\n```\r\nreturns a document, while\r\n```\r\n{\r\n  \"query\": {\r\n    \"term\": {\r\n      \"clientRelationship.policy.policyHolder.firstName.key\": \"Jeff Awesome\"\r\n    }\r\n  }\r\n}\r\n```\r\ndoes not\r\n\r\n\r\n"}}
{"actor":{"display_login":"pirovorster"}}