code: def get_elastic_items(elastic, elastic_scroll_id=None, limit=None):
      
  
      scroll_size = limit
      if not limit:
          scroll_size = DEFAULT_LIMIT
  
      if not elastic:
          return None
  
      url = elastic.index_url
      max_process_items_pack_time = "5m"  # 10 minutes
      url += "/_search?scroll=%s&size=%i" % (max_process_items_pack_time,
                                             scroll_size)
  
      if elastic_scroll_id:
          # Just continue with the scrolling
          url = elastic.url
          url += "/_search/scroll"
          scroll_data = {
              "scroll": max_process_items_pack_time,
              "scroll_id": elastic_scroll_id
          }
          res = requests.post(url, data=json.dumps(scroll_data))
      else:
          query = """
          {
              "query": {
                  "bool": {
                      "must": []
                  }
              }
          }
          """
  
          logging.debug("%s\n%s", url, json.dumps(json.loads(query), indent=4))
          res = requests.post(url, data=query)
  
      rjson = None
      try:
          rjson = res.json()
      except Exception:
          logging.error("No JSON found in %s", res.text)
          logging.error("No results found from %s", url)
  
      return rjson
docs: Get the items from the index