{"action":"opened","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-ruby/issues/537","repository_url":"https://api.github.com/repos/elastic/elasticsearch-ruby","labels_url":"https://api.github.com/repos/elastic/elasticsearch-ruby/issues/537/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-ruby/issues/537/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-ruby/issues/537/events","html_url":"https://github.com/elastic/elasticsearch-ruby/issues/537","id":347784121,"node_id":"MDU6SXNzdWUzNDc3ODQxMjE=","number":537,"title":"I can't see how to iterate over response returned from query","user":{"login":"brettskiii","id":127610,"node_id":"MDQ6VXNlcjEyNzYxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/127610?v=4","gravatar_id":"","url":"https://api.github.com/users/brettskiii","html_url":"https://github.com/brettskiii","followers_url":"https://api.github.com/users/brettskiii/followers","following_url":"https://api.github.com/users/brettskiii/following{/other_user}","gists_url":"https://api.github.com/users/brettskiii/gists{/gist_id}","starred_url":"https://api.github.com/users/brettskiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettskiii/subscriptions","organizations_url":"https://api.github.com/users/brettskiii/orgs","repos_url":"https://api.github.com/users/brettskiii/repos","events_url":"https://api.github.com/users/brettskiii/events{/privacy}","received_events_url":"https://api.github.com/users/brettskiii/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-06T05:34:32Z","updated_at":"2018-08-06T05:34:32Z","closed_at":null,"author_association":"NONE","body":"I'm doing something like this:\r\n\r\n```\r\nresponse = client.search index: 'daemon-statistics', body: {from: 0, size: 2, sort: [{event_at: {order: \"desc\"}}], query:  {bool: {\r\n     must: [\r\n         {match: {\r\n           tenant_id: \"108\"\r\n             }},\r\n         {match: {\r\n           event: \"daemon-job-name\"\r\n         }},\r\n        \r\n     ]\r\n   } } }\r\n```\r\n\r\nwhich returns a string..\r\n\r\n```\r\n--- took: 5 timed_out: false _shards: total: 5 successful: 5 skipped: 0 failed: 0 hits: total: 2358 max_score: null hits: - _index: \"daemon-statistics\" _type: \"event\" _id: \"LsRzDWUBhKWdreNuciC3\" _score: null _source: daemon_uuid: \"8fe5e891-dda4-4bec-b7bc-c4ed7e83e2d4\" event: \"daemon-job-name\" sequence_id: 15 event_at: \"2018-08-06T04:16:34.438Z\" time_elapsed: 161 tenant_id: 108 campaign_id: 2282 sort: - 1533528994438 - _index: \"daemon-statistics\" _type: \"event\" _id: \"LcRzDWUBhKWdreNuciA8\" _score: null _source: daemon_uuid: \"8fe5e891-dda4-4bec-b7bc-c4ed7e83e2d4\" event: \"daemon-job-name\" sequence_id: 15 event_at: \"2018-08-06T04:16:34.277Z\" time_elapsed: 155 tenant_id: 108 campaign_id: 269 sort: - 1533528994277\r\n```\r\n\r\n```JSON.parse(response)``` will result in:\r\n\r\n```\r\nJSON::ParserError at /\r\n784: unexpected token at '---\r\ntook: 3\r\n```\r\n\r\nor as suggested in the docs, the ```mash = Hashie::Mash.new response``` results in:\r\n\r\n```\r\nNoMethodError at /\r\nundefined method `each_pair' for #<String:0x00007fa7d10008e0>\r\nDid you mean?  each_char\r\n```\r\n\r\nI'm a bit lost been looking around for a solution, but can't seem to understand how to take the response returned from the client which comes in as a string and convert it to something I can iterate the results over.\r\n"}}
{"actor":{"display_login":"brettskiii"}}