def bulk( body = nil, params = nil )
      if block_given?
        params, body = (body || {}), nil
        yield bulk_obj = Bulk.new(self, params)
        bulk_obj.call

      else
        raise "bulk request body cannot be nil" if body.nil?
        params ||= {}

        response = self.post "{/index}{/type}/_bulk", params.merge(body: body, action: "bulk", rest_api: "bulk")
        response.body
      end
    end
def bulk( body = nil, params = nil )
      if block_given?
        params, body = (body || {}), nil
        yield bulk_obj = Bulk.new(self, params)
        bulk_obj.call

      else
        raise "bulk request body cannot be nil" if body.nil?
        params ||= {}

        response = self.post "{/index}{/type}/_bulk", params.merge(body: body, action: "bulk", rest_api: "bulk")
        response.body
      end
    end
The `bulk` method can be used in two ways. Without a block the method
 will perform an API call, and it requires a bulk request body and
 optional request parameters. If given a block, the method will use a
 Bulk instance to assemble the operations called in the block into a
 bulk request and dispatch it at the end of the block.

 See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

 body   - Request body as a String (required if a block is _not_ given)
 params - Optional request parameters as a Hash
   :request_size - Optional maximum request size in bytes
   :action_count - Optional maximum action size
 block  - Passed to a Bulk instance which assembles the operations
          into one or more bulk requests.

 Examples

   bulk(request_body, :index => 'default-index')

   bulk(:index => 'default-index') do |b|
     b.index(document1)
     b.index(document2, :_type => 'default-type')
     b.delete(document3)
     ...
   end

 Returns the response body as a Hash