def bulk_stream_items(ops, params = {})
      stats = {
        "took" => 0,
        "errors" => false,
        "success" => 0,
        "failure" => 0
      }

      bulk_stream_responses(ops, params).each do |response|
        stats["took"] += response["took"]
        stats["errors"] |= response["errors"]

        response["items"].each do |item|
          if is_ok?(item)
            stats["success"] += 1
          else
            stats["failure"] += 1
          end
          yield item
        end
      end

      stats
    end
def bulk_stream_items(ops, params = {})
      stats = {
        "took" => 0,
        "errors" => false,
        "success" => 0,
        "failure" => 0
      }

      bulk_stream_responses(ops, params).each do |response|
        stats["took"] += response["took"]
        stats["errors"] |= response["errors"]

        response["items"].each do |item|
          if is_ok?(item)
            stats["success"] += 1
          else
            stats["failure"] += 1
          end
          yield item
        end
      end

      stats
    end
Stream bulk actions from an Enumerator and passes the response items to
 the given block.

 Examples

   ops = [
     [:index, document1, {:_type => "foo", :_id => 1}],
     [:create, document2],
     [:delete, {:_type => "bar", :_id => 42}]
   ]
   bulk_stream_items(ops, :index => 'default-index') do |item|
     puts item
   end

   # return value:
   # {
   #   "took" => 256,
   #   "errors" => false,
   #   "success" => 3,
   #   "failure" => 0
   # }

   # sample response item:
   # {
   #   "delete": {
   #     "_index": "foo",
   #     "_type": "bar",
   #     "_id": "42",
   #     "_version": 3,
   #     "status": 200,
   #     "found": true
   #   }
   # }

 Returns a Hash of stats about items from the responses.