{"action":"closed","issue":{"url":"https://api.github.com/repos/ropensci/elastic/issues/228","repository_url":"https://api.github.com/repos/ropensci/elastic","labels_url":"https://api.github.com/repos/ropensci/elastic/issues/228/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/elastic/issues/228/comments","events_url":"https://api.github.com/repos/ropensci/elastic/issues/228/events","html_url":"https://github.com/ropensci/elastic/issues/228","id":344517282,"node_id":"MDU6SXNzdWUzNDQ1MTcyODI=","number":228,"title":"incorrect scroll example","user":{"login":"Neleawan","id":10046694,"node_id":"MDQ6VXNlcjEwMDQ2Njk0","avatar_url":"https://avatars2.githubusercontent.com/u/10046694?v=4","gravatar_id":"","url":"https://api.github.com/users/Neleawan","html_url":"https://github.com/Neleawan","followers_url":"https://api.github.com/users/Neleawan/followers","following_url":"https://api.github.com/users/Neleawan/following{/other_user}","gists_url":"https://api.github.com/users/Neleawan/gists{/gist_id}","starred_url":"https://api.github.com/users/Neleawan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Neleawan/subscriptions","organizations_url":"https://api.github.com/users/Neleawan/orgs","repos_url":"https://api.github.com/users/Neleawan/repos","events_url":"https://api.github.com/users/Neleawan/events{/privacy}","received_events_url":"https://api.github.com/users/Neleawan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ropensci/elastic/milestones/8","html_url":"https://github.com/ropensci/elastic/milestone/8","labels_url":"https://api.github.com/repos/ropensci/elastic/milestones/8/labels","id":1901071,"node_id":"MDk6TWlsZXN0b25lMTkwMTA3MQ==","number":8,"title":"v0.9","description":"","creator":{"login":"sckott","id":577668,"node_id":"MDQ6VXNlcjU3NzY2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/577668?v=4","gravatar_id":"","url":"https://api.github.com/users/sckott","html_url":"https://github.com/sckott","followers_url":"https://api.github.com/users/sckott/followers","following_url":"https://api.github.com/users/sckott/following{/other_user}","gists_url":"https://api.github.com/users/sckott/gists{/gist_id}","starred_url":"https://api.github.com/users/sckott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sckott/subscriptions","organizations_url":"https://api.github.com/users/sckott/orgs","repos_url":"https://api.github.com/users/sckott/repos","events_url":"https://api.github.com/users/sckott/events{/privacy}","received_events_url":"https://api.github.com/users/sckott/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":2,"state":"open","created_at":"2016-07-24T17:49:28Z","updated_at":"2018-07-27T21:50:51Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2018-07-25T16:28:12Z","updated_at":"2018-07-27T21:50:51Z","closed_at":"2018-07-27T21:50:51Z","author_association":"NONE","body":"Hello,\r\nIn the documentation and the vignette, the scroll example is incorrect.\r\nAt least for my case with elasticsearch 2.3\r\n\r\nThe example is the following;\r\n```r\r\nres <- Search(index = 'shakespeare', q=\"a*\", time_scroll=\"5m\")\r\nout <- list()\r\nhits <- 1\r\nwhile(hits != 0){\r\n    res <- scroll(res$`_scroll_id`)\r\n    hits <- length(res$hits$hits)\r\n    if(hits > 0)\r\n      out <- c(out, res$hits$hits)\r\n}\r\n```\r\n\r\nBut by doing so, since the default size of Search is 10, you miss 10 results from the first Search.\r\nActually, the first Search return a scroll id for the next results.\r\nAnd I think that if you add the time_scroll in the first `Search`, you should as well in the `scroll`.\r\n\r\nSo I think that the example should be something like this, in order to retrieve all the results:\r\n\r\n```r\r\nres <- Search(index = 'shakespeare', q=\"a*\", time_scroll=\"5m\")\r\nout <- list()\r\nhits <- length(res$hits$hits)\r\nif(hits > 0){\r\n    out <- c(out, res$hits$hits)\r\n    while(hits != 0){\r\n        res <- scroll(res$`_scroll_id`,  time_scroll=\"5m\")\r\n        hits <- length(res$hits$hits)\r\n        if(hits > 0){\r\n            out <- c(out, res$hits$hits)\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n"}}
{"actor":{"display_login":"sckott"}}