{"action":"created","issue":{"url":"https://api.github.com/repos/Zatvobor/tirexs/issues/255","repository_url":"https://api.github.com/repos/Zatvobor/tirexs","labels_url":"https://api.github.com/repos/Zatvobor/tirexs/issues/255/labels{/name}","comments_url":"https://api.github.com/repos/Zatvobor/tirexs/issues/255/comments","events_url":"https://api.github.com/repos/Zatvobor/tirexs/issues/255/events","html_url":"https://github.com/Zatvobor/tirexs/issues/255","id":189800396,"number":255,"title":"Merge/Extend query","user":{"login":"radzserg","id":293785,"avatar_url":"https://avatars.githubusercontent.com/u/293785?v=3","gravatar_id":"","url":"https://api.github.com/users/radzserg","html_url":"https://github.com/radzserg","followers_url":"https://api.github.com/users/radzserg/followers","following_url":"https://api.github.com/users/radzserg/following{/other_user}","gists_url":"https://api.github.com/users/radzserg/gists{/gist_id}","starred_url":"https://api.github.com/users/radzserg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radzserg/subscriptions","organizations_url":"https://api.github.com/users/radzserg/orgs","repos_url":"https://api.github.com/users/radzserg/repos","events_url":"https://api.github.com/users/radzserg/events{/privacy}","received_events_url":"https://api.github.com/users/radzserg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-16T18:31:58Z","updated_at":"2016-11-18T15:32:29Z","closed_at":null,"body":"Sorry for question - but I didn't find the better way where to ask it? What is the recommended way to dynamically build queries. For example I have a list of filter parameters before I build the query\r\n\r\n\r\n```\r\nif filter_params.first_name do \r\n  query = search [index: \"my-index\"] do\r\n       query do\r\n         match \"first_name\", filter_params.first_name\r\n       end\r\n  end\r\nend\r\n\r\nif filter_params.last_name do \r\n  # At this point I want to inject    match \"last_name\", filter_params.last_name\r\n  # to basic query \r\nend\r\n\r\n````\r\n\r\nThis is very simple example in real life queries can be much more complex with different nesting level.\r\n\r\nThanks.\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/Zatvobor/tirexs/issues/comments/261560267","html_url":"https://github.com/Zatvobor/tirexs/issues/255#issuecomment-261560267","issue_url":"https://api.github.com/repos/Zatvobor/tirexs/issues/255","id":261560267,"user":{"login":"radzserg","id":293785,"avatar_url":"https://avatars.githubusercontent.com/u/293785?v=3","gravatar_id":"","url":"https://api.github.com/users/radzserg","html_url":"https://github.com/radzserg","followers_url":"https://api.github.com/users/radzserg/followers","following_url":"https://api.github.com/users/radzserg/following{/other_user}","gists_url":"https://api.github.com/users/radzserg/gists{/gist_id}","starred_url":"https://api.github.com/users/radzserg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radzserg/subscriptions","organizations_url":"https://api.github.com/users/radzserg/orgs","repos_url":"https://api.github.com/users/radzserg/repos","events_url":"https://api.github.com/users/radzserg/events{/privacy}","received_events_url":"https://api.github.com/users/radzserg/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T15:32:29Z","updated_at":"2016-11-18T15:32:29Z","body":"Trying...  and getting this error\r\n```\r\n\r\niex(2)> query = search [index: \"my-index\"] do\r\n...(2)> if 1 == 1 do\r\n...(2)> query do match \"first_name\", \"John\"  \r\n...(2)> end\r\n...(2)> end\r\n...(2)> end\r\n** (CaseClauseError) no case clause matching: {:if, [line: 3], [{:==, [line: 3], [1, 1]}, [do: {:query, [line: 4], [[do: {:match, [line: 4], [\"first_name\", \"John\"]}]]}]]}\r\n    lib/tirexs/search.ex:48: Tirexs.Search.transpose/1\r\n    lib/tirexs/search.ex:28: Tirexs.Search.extract/2\r\n    expanding macro: Tirexs.Search.search/2\r\n    iex:2: (file)\r\n\r\n```"}}
{"actor":{"display_login":"radzserg"}}