{"action":"created","issue":{"url":"https://api.github.com/repos/olivere/elastic/issues/111","labels_url":"https://api.github.com/repos/olivere/elastic/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/olivere/elastic/issues/111/comments","events_url":"https://api.github.com/repos/olivere/elastic/issues/111/events","html_url":"https://github.com/olivere/elastic/issues/111","id":98093031,"number":111,"title":"Declare variabel","user":{"login":"tommoholmes","id":12724592,"avatar_url":"https://avatars.githubusercontent.com/u/12724592?v=3","gravatar_id":"","url":"https://api.github.com/users/tommoholmes","html_url":"https://github.com/tommoholmes","followers_url":"https://api.github.com/users/tommoholmes/followers","following_url":"https://api.github.com/users/tommoholmes/following{/other_user}","gists_url":"https://api.github.com/users/tommoholmes/gists{/gist_id}","starred_url":"https://api.github.com/users/tommoholmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommoholmes/subscriptions","organizations_url":"https://api.github.com/users/tommoholmes/orgs","repos_url":"https://api.github.com/users/tommoholmes/repos","events_url":"https://api.github.com/users/tommoholmes/events{/privacy}","received_events_url":"https://api.github.com/users/tommoholmes/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-30T06:00:10Z","updated_at":"2015-07-30T07:42:14Z","closed_at":"2015-07-30T07:42:14Z","body":"I want to make API with elastic. I have some trouble\r\nI want to declare variabel.\r\nthis my code \r\n```go\r\nvar q struct{}\r\nif json.Title != \"\"{\r\n    q = elastic.NewMatchQuery(\"title\", json.Title)\r\n}else{\r\n    q = elastic.NewMatchAllQuery()\r\n}\r\nbuilder := client.Search().Index(\"witch\").Query(q).From(json.From).Size(21).Sort(\"price\", true)\r\ntopTagsHitsAgg := elastic.NewTopHitsAggregation().Size(10).FetchSource(true)\r\ntopTagsAgg := elastic.NewTermsAggregation().Field(\"brand\").Size(0).SubAggregation(\"top_tag_hits\", topTagsHitsAgg)\r\nbuilder = builder.Aggregation(\"top\", topTagsAgg)\r\nsearchResult, err := builder.Do()\r\n```\r\nbut when i runing this code\r\nwarning cannot use elastic.NewMatchQuery(\"title\", json.Title) (type elastic.MatchQuery) as type struct {} in assignment"},"comment":{"url":"https://api.github.com/repos/olivere/elastic/issues/comments/126211640","html_url":"https://github.com/olivere/elastic/issues/111#issuecomment-126211640","issue_url":"https://api.github.com/repos/olivere/elastic/issues/111","id":126211640,"user":{"login":"olivere","id":134848,"avatar_url":"https://avatars.githubusercontent.com/u/134848?v=3","gravatar_id":"","url":"https://api.github.com/users/olivere","html_url":"https://github.com/olivere","followers_url":"https://api.github.com/users/olivere/followers","following_url":"https://api.github.com/users/olivere/following{/other_user}","gists_url":"https://api.github.com/users/olivere/gists{/gist_id}","starred_url":"https://api.github.com/users/olivere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivere/subscriptions","organizations_url":"https://api.github.com/users/olivere/orgs","repos_url":"https://api.github.com/users/olivere/repos","events_url":"https://api.github.com/users/olivere/events{/privacy}","received_events_url":"https://api.github.com/users/olivere/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T07:42:14Z","updated_at":"2015-07-30T07:42:14Z","body":"When you write sth like json.Title, Go expects you to have a struct called json with a field called Title.\r\n\r\nYou should really do the Go tour at golang.org to get the basics of the language."}}