{"action":"closed","issue":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6871","labels_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6871/labels{/name}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6871/comments","events_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6871/events","html_url":"https://github.com/elasticsearch/elasticsearch/issues/6871","id":37862177,"number":6871,"title":"\"matched_queries\" does not include queries within a wrapper query","user":{"login":"tstibbs","id":4869014,"avatar_url":"https://avatars.githubusercontent.com/u/4869014?v=3","gravatar_id":"","url":"https://api.github.com/users/tstibbs","html_url":"https://github.com/tstibbs","followers_url":"https://api.github.com/users/tstibbs/followers","following_url":"https://api.github.com/users/tstibbs/following{/other_user}","gists_url":"https://api.github.com/users/tstibbs/gists{/gist_id}","starred_url":"https://api.github.com/users/tstibbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tstibbs/subscriptions","organizations_url":"https://api.github.com/users/tstibbs/orgs","repos_url":"https://api.github.com/users/tstibbs/repos","events_url":"https://api.github.com/users/tstibbs/events{/privacy}","received_events_url":"https://api.github.com/users/tstibbs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/labels/bug","name":"bug","color":"9e2c2c"}],"state":"closed","locked":false,"assignee":{"login":"martijnvg","id":580421,"avatar_url":"https://avatars.githubusercontent.com/u/580421?v=3","gravatar_id":"","url":"https://api.github.com/users/martijnvg","html_url":"https://github.com/martijnvg","followers_url":"https://api.github.com/users/martijnvg/followers","following_url":"https://api.github.com/users/martijnvg/following{/other_user}","gists_url":"https://api.github.com/users/martijnvg/gists{/gist_id}","starred_url":"https://api.github.com/users/martijnvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martijnvg/subscriptions","organizations_url":"https://api.github.com/users/martijnvg/orgs","repos_url":"https://api.github.com/users/martijnvg/repos","events_url":"https://api.github.com/users/martijnvg/events{/privacy}","received_events_url":"https://api.github.com/users/martijnvg/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2014-07-15T08:42:24Z","updated_at":"2015-01-07T08:21:13Z","closed_at":"2015-01-07T08:21:13Z","body":"I have a document in an index such that the following request returns a match, with the `matched_queries` element containing `query1`:\r\n\r\n    curl -XPOST 'http://localhost:9200/index/_search' –d '\r\n    {\r\n      \"query\": {\r\n        \"match\": {\r\n          \"stuff\": {\r\n            \"_name\": \"query1\",\r\n            \"query\": \"blah\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n    '\r\n\r\nHowever, if that query is wrapped in a wrapper query, then the name does not appear in the list of `matched_queries`:\r\n\r\n    curl -XPOST 'http://localhost:9200/index/_search' –d '\r\n    {\r\n      \"query\": {\r\n        \"wrapper\": {\r\n          \"query\": \"eyJtYXRjaCI6IHsic3R1ZmYiOiB7Il9uYW1lIjogInF1ZXJ5MSIsICJxdWVyeSI6ICJibGFoIn19fQ==\"\r\n        }\r\n      }\r\n    }\r\n    '\r\n\r\nI am using the java api and the `WrapperQueryBuilder`, but the effect is the same whether using the java api or the rest interface.\r\n\r\n(gist with set-up steps in case it's useful: https://gist.github.com/tstibbs/645e01c5dcdfa9d2a193)"}}