def extract_body( params )
      body = params.delete :body
      return if body.nil?

      body =
        case body
        when String
          body
        when Array
          body << nil unless body.last.nil?
          body.join "\n"
        else
          MultiJson.dump body
        end

      # Prevent excon from changing the encoding (see https://github.com/github/elastomer-client/issues/138)
      body.freeze
    end
def extract_body( params )
      body = params.delete :body
      return if body.nil?

      body =
        case body
        when String
          body
        when Array
          body << nil unless body.last.nil?
          body.join "\n"
        else
          MultiJson.dump body
        end

      # Prevent excon from changing the encoding (see https://github.com/github/elastomer-client/issues/138)
      body.freeze
    end
Internal: Extract the :body from the params Hash and convert it to a
 JSON String format. If the params Hash does not contain a :body then no
 action is taken and `nil` is returned.

 If a :body is present and is a String then it is assumed to a JSON String
 and returned "as is".

 If a :body is present and is an Array then we join the values together
 with newlines and append a trailing newline. This is a special case for
 dealing with ES `bulk` imports and `multi_search` methods.

 Otherwise we convert the :body to a JSON string and return.

 params - Parameters Hash

 Returns the request body as a String or `nil` if no :body is present