{"action":"created","issue":{"url":"https://api.github.com/repos/danpaz/bodybuilder/issues/51","repository_url":"https://api.github.com/repos/danpaz/bodybuilder","labels_url":"https://api.github.com/repos/danpaz/bodybuilder/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/danpaz/bodybuilder/issues/51/comments","events_url":"https://api.github.com/repos/danpaz/bodybuilder/issues/51/events","html_url":"https://github.com/danpaz/bodybuilder/issues/51","id":173201363,"number":51,"title":"should nested within must","user":{"login":"fuwifi","id":15659609,"avatar_url":"https://avatars.githubusercontent.com/u/15659609?v=3","gravatar_id":"","url":"https://api.github.com/users/fuwifi","html_url":"https://github.com/fuwifi","followers_url":"https://api.github.com/users/fuwifi/followers","following_url":"https://api.github.com/users/fuwifi/following{/other_user}","gists_url":"https://api.github.com/users/fuwifi/gists{/gist_id}","starred_url":"https://api.github.com/users/fuwifi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fuwifi/subscriptions","organizations_url":"https://api.github.com/users/fuwifi/orgs","repos_url":"https://api.github.com/users/fuwifi/repos","events_url":"https://api.github.com/users/fuwifi/events{/privacy}","received_events_url":"https://api.github.com/users/fuwifi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-25T13:21:16Z","updated_at":"2016-08-25T14:56:12Z","closed_at":null,"body":"I am curious if it is possible with this module to set up a complex elastic query that has should queries nested within a must.\r\n\r\nSimply, I am trying to recreate this SQL query: \r\n`SELECT * FROM test where status = 'active' and (city = 'New York' or city = 'Toronto')`\r\n\r\nI would like to get back something similar to the below, but I have only been able to have the MUST and the SHOULD on the same level.  Is this functionality possible? It seems like a simple query case, but maybe I am wrong.\r\n\r\n```\r\n{\r\n\t\"query\": {\r\n\t\t\"bool\": {\r\n\t\t\t\"must\": {\r\n\t\t\t\t\"bool\": {\r\n\t\t\t\t\t\"must\": [\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"match\": {\r\n\t\t\t\t\t\t\t\t\"status\": {\r\n\t\t\t\t\t\t\t\t\t\"query\": \"active\"\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"bool\": {\r\n\t\t\t\t\t\t\t\t\"should\": [\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\"match\": {\r\n\t\t\t\t\t\t\t\t\t\t\t\"city\": {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\"query\": \"New York\"\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\"match\": {\r\n\t\t\t\t\t\t\t\t\t\t\t\"city\": {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\"query\": \"Toronto\"\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"},"comment":{"url":"https://api.github.com/repos/danpaz/bodybuilder/issues/comments/242418358","html_url":"https://github.com/danpaz/bodybuilder/issues/51#issuecomment-242418358","issue_url":"https://api.github.com/repos/danpaz/bodybuilder/issues/51","id":242418358,"user":{"login":"danpaz","id":5665333,"avatar_url":"https://avatars.githubusercontent.com/u/5665333?v=3","gravatar_id":"","url":"https://api.github.com/users/danpaz","html_url":"https://github.com/danpaz","followers_url":"https://api.github.com/users/danpaz/followers","following_url":"https://api.github.com/users/danpaz/following{/other_user}","gists_url":"https://api.github.com/users/danpaz/gists{/gist_id}","starred_url":"https://api.github.com/users/danpaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danpaz/subscriptions","organizations_url":"https://api.github.com/users/danpaz/orgs","repos_url":"https://api.github.com/users/danpaz/repos","events_url":"https://api.github.com/users/danpaz/events{/privacy}","received_events_url":"https://api.github.com/users/danpaz/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T14:56:12Z","updated_at":"2016-08-25T14:56:12Z","body":"Nested queries haven't been developed yet, but I think it is possible to add this. https://github.com/danpaz/bodybuilder/pull/16 is a good example of how this was done for nesting aggregations and I think a similar approach could work here."}}
{"actor":{"display_login":"danpaz"}}