lib/elasticsearch/api/actions/termvectors.rb in elasticsearch-api-6.8.3 vs lib/elasticsearch/api/actions/termvectors.rb in elasticsearch-api-7.0.0.pre

- old
+ new

@@ -1,8 +1,21 @@ -# Licensed to Elasticsearch B.V under one or more agreements. -# Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -# See the LICENSE file in the project root for more information +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. module Elasticsearch module API module Actions @@ -11,16 +24,14 @@ # @example Get statistics for an indexed document # # client.indices.create index: 'my_index', # body: { # mappings: { - # my_type: { - # properties: { - # text: { - # type: 'string', - # term_vector: 'with_positions_offsets_payloads' - # } + # properties: { + # text: { + # type: 'string', + # term_vector: 'with_positions_offsets_payloads' # } # } # } # } # @@ -38,13 +49,12 @@ # text: 'Foo Bar Fox' # } # } # # => { ..., "term_vectors" => { "text" => { "field_statistics" => { ... }, "terms" => { "bar" => ... } } } # - # # @option arguments [String] :index The index in which the document resides. (*Required*) - # @option arguments [String] :type The type of the document. (*Required*) + # @option arguments [String] :type The type of the document. # @option arguments [String] :id The id of the document, when not specified a doc param should be supplied. # @option arguments [Hash] :body Define parameters and or supply a document to get termvectors for. See documentation. # @option arguments [Boolean] :term_statistics Specifies if total term frequency and document frequency should be returned. # @option arguments [Boolean] :field_statistics Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. # @option arguments [List] :fields A comma-separated list of fields to return. @@ -56,22 +66,27 @@ # @option arguments [String] :parent Parent id of documents. # @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) # - # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-termvectors.html + # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/docs-termvectors.html # def termvectors(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] - raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] method = HTTP_GET endpoint = arguments.delete(:endpoint) || '_termvectors' - path = Utils.__pathify Utils.__escape(arguments[:index]), - Utils.__escape(arguments[:type]), - arguments[:id], - endpoint + if arguments[:type] + path = Utils.__pathify Utils.__escape(arguments[:index]), + arguments[:type], + arguments[:id], + endpoint + else + path = Utils.__pathify Utils.__escape(arguments[:index]), + endpoint, + arguments[:id] + end params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] perform_request(method, path, params, body).body @@ -83,10 +98,10 @@ termvectors(arguments.merge :endpoint => '_termvector') end # Register this action with its valid params when the module is loaded. # - # @since 6.2.0 + # @since 6.1.1 ParamsRegistry.register(:termvectors, [ :term_statistics, :field_statistics, :fields, :offsets,