def chunk_save(path=nil, method="POST", docs, param, header)
      @multi = true

      if path.nil?
        path = uri
      end

      unless docs.is_a? Array
        docs = JSON.parse(docs)
      end


      if docs.is_a? Hash
        docs = [docs]
      end

      if slice < docs.size
        log.debug "Slicing #{docs.size} documents into #{slice} chunks"
      end

      docs.each_slice(slice) do | chunk |
        queue(method, path, chunk.to_json, param, header)
      end
      hydra.run

      # @todo => on complete
      successes = @responses.select {|r| (200..299).include? r.code }
      if successes.size > 0

        if docs.size < slice
          log.info "Saved #{docs.size} document(s) using #{@responses.size} #{method} request(s). Concurrency: #{concurrency}"
        else
          log.info "Saved #{docs.size} documents, sliced into chunks of #{slice} using #{@responses.size} #{method} requests.  Concurrency: #{concurrency}"
        end
      end

      failures = @responses.reject {|r| (200..299).include? r.code }
      if failures.size > 0
        log.debug "#chunk_save error in #{failures.size}/#{responses.size} requests"
      end

      @responses
    end
def chunk_save(path=nil, method="POST", docs, param, header)
      @multi = true

      if path.nil?
        path = uri
      end

      unless docs.is_a? Array
        docs = JSON.parse(docs)
      end


      if docs.is_a? Hash
        docs = [docs]
      end

      if slice < docs.size
        log.debug "Slicing #{docs.size} documents into #{slice} chunks"
      end

      docs.each_slice(slice) do | chunk |
        queue(method, path, chunk.to_json, param, header)
      end
      hydra.run

      # @todo => on complete
      successes = @responses.select {|r| (200..299).include? r.code }
      if successes.size > 0

        if docs.size < slice
          log.info "Saved #{docs.size} document(s) using #{@responses.size} #{method} request(s). Concurrency: #{concurrency}"
        else
          log.info "Saved #{docs.size} documents, sliced into chunks of #{slice} using #{@responses.size} #{method} requests.  Concurrency: #{concurrency}"
        end
      end

      failures = @responses.reject {|r| (200..299).include? r.code }
      if failures.size > 0
        log.debug "#chunk_save error in #{failures.size}/#{responses.size} requests"
      end

      @responses
    end
Slice Array of documents into chunks of #slice size and queue up for POST or PUT
 @return [Array] responses