lib/elasticsearch/api/actions/termvectors.rb in elasticsearch-api-7.8.1 vs lib/elasticsearch/api/actions/termvectors.rb in elasticsearch-api-7.9.0.pre
- old
+ new
@@ -33,19 +33,20 @@
# @option arguments [String] :routing Specific routing value.
# @option arguments [Boolean] :realtime Specifies if request is real-time as opposed to near-real-time (default: true).
# @option arguments [Number] :version Explicit version number for concurrency control
# @option arguments [String] :version_type Specific version type
# (options: internal,external,external_gte,force)
+
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body Define parameters and or supply a document to get termvectors for. See documentation.
#
# *Deprecation notice*:
# Specifying types in urls has been deprecated
# Deprecated since version 7.0.0
#
#
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.8/docs-termvectors.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-termvectors.html
#
def termvectors(arguments = {})
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
headers = arguments.delete(:headers) || {}
@@ -56,22 +57,26 @@
_id = arguments.delete(:id)
_type = arguments.delete(:type)
- method = Elasticsearch::API::HTTP_GET
+ method = if arguments[:body]
+ Elasticsearch::API::HTTP_POST
+ else
+ Elasticsearch::API::HTTP_GET
+ end
endpoint = arguments.delete(:endpoint) || '_termvectors'
path = if _index && _type && _id
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{Utils.__listify(_id)}/#{endpoint}"
elsif _index && _type
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{endpoint}"
elsif _index && _id
"#{Utils.__listify(_index)}/#{endpoint}/#{Utils.__listify(_id)}"
else
"#{Utils.__listify(_index)}/#{endpoint}"
- end
+ end
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
body = arguments[:body]
perform_request(method, path, params, body, headers).body
@@ -97,7 +102,7 @@
:realtime,
:version,
:version_type
].freeze)
end
- end
+ end
end