diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index 05647cb685..d7650033d0 100644 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -1,6 +1,6 @@ --- ELASTICSEARCH_VERSION: -- 7.x-SNAPSHOT +- 7.7-SNAPSHOT RUBY_TEST_VERSION: - 2.7 diff --git a/.github/workflows/7.x.yml b/.github/workflows/7.x.yml index d4c0588985..06e3ba17bc 100644 --- a/.github/workflows/7.x.yml +++ b/.github/workflows/7.x.yml @@ -25,7 +25,7 @@ jobs: sudo sysctl -w vm.max_map_count=262144 - uses: elastic/elastic-github-actions/elasticsearch@master with: - stack-version: 7.x-SNAPSHOT + stack-version: 7.7-SNAPSHOT - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} diff --git a/.travis.yml b/.travis.yml index 9392b29fb1..3f15a1d473 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ branches: env: global: - TEST_ES_SERVER=http://localhost:9250 - - ELASTICSEARCH_VERSION=7.6.2 + - ELASTICSEARCH_VERSION=7.7.0 matrix: include: diff --git a/api-spec-testing/test_file.rb b/api-spec-testing/test_file.rb index 8dbcab2e1f..08b64cd194 100644 --- a/api-spec-testing/test_file.rb +++ b/api-spec-testing/test_file.rb @@ -178,10 +178,6 @@ def clear_machine_learning_indices(client) def clear_index_templates(client) client.indices.delete_template(name: '*') - templates = client.indices.get_index_template - templates['index_templates'].each do |template| - client.indices.delete_index_template(name: template['name']) - end end def clear_snapshots_and_repositories(client) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/abort_benchmark.rb b/elasticsearch-api/lib/elasticsearch/api/actions/abort_benchmark.rb deleted file mode 100644 index ad80c9297e..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/abort_benchmark.rb +++ /dev/null @@ -1,28 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Actions - # Abort a running benchmark - # - # @example - # - # client.abort_benchmark name: 'my_benchmark' - # - # @option arguments [String] :name A benchmark name - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-benchmark.html - # - def abort_benchmark(arguments = {}) - method = HTTP_POST - path = "_bench/abort/#{arguments[:name]}" - params = {} - body = nil - - perform_request(method, path, params, body).body - end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/benchmark.rb b/elasticsearch-api/lib/elasticsearch/api/actions/benchmark.rb deleted file mode 100644 index 6f5229db84..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/benchmark.rb +++ /dev/null @@ -1,68 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Actions - # Run a single query, or a set of queries, and return statistics on their performance - # - # @example Return statistics for a single query - # - # client.benchmark body: { - # name: 'my_benchmark', - # competitors: [ - # { - # name: 'query_1', - # requests: [ - # { query: { match: { _all: 'a*' } } } - # ] - # } - # ] - # } - # - # @example Return statistics for a set of "competing" queries - # - # client.benchmark body: { - # name: 'my_benchmark', - # competitors: [ - # { - # name: 'query_a', - # requests: [ - # { query: { match: { _all: 'a*' } } } - # ] - # }, - # { - # name: 'query_b', - # requests: [ - # { query: { match: { _all: 'b*' } } } - # ] - # } - # ] - # } - # - # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string - # to perform the operation on all indices - # @option arguments [String] :type The name of the document type - # @option arguments [Hash] :body The search definition using the Query DSL - # @option arguments [Boolean] :verbose Specify whether to return verbose statistics about each iteration - # (default: false) - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-benchmark.html - # - def benchmark(arguments = {}) - method = HTTP_PUT - path = "_bench" - params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - body = arguments[:body] - - perform_request(method, path, params, body).body - end - - # Register this action with its valid params when the module is loaded. - # - # @since 6.1.1 - ParamsRegistry.register(:benchmark, [:verbose].freeze) - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cluster/exists_component_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cluster/exists_component_template.rb deleted file mode 100644 index a547e690c9..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cluster/exists_component_template.rb +++ /dev/null @@ -1,46 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Cluster - module Actions - # Returns information about whether a particular component template exist - # - # @option arguments [String] :name The name of the template - # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node - # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) - # @option arguments [Hash] :headers Custom HTTP headers - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html - # - def exists_component_template(arguments = {}) - raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] - - headers = arguments.delete(:headers) || {} - - arguments = arguments.clone - - _name = arguments.delete(:name) - - method = Elasticsearch::API::HTTP_HEAD - path = "_component_template/#{Utils.__listify(_name)}" - params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - - body = nil - perform_request(method, path, params, body, headers).body - end - - alias_method :exists_component_template?, :exists_component_template - # Register this action with its valid params when the module is loaded. - # - # @since 6.2.0 - ParamsRegistry.register(:exists_component_template, [ - :master_timeout, - :local - ].freeze) -end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/delete_by_rethrottle.rb b/elasticsearch-api/lib/elasticsearch/api/actions/delete_by_rethrottle.rb deleted file mode 100644 index 84e2b1d071..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +++ /dev/null @@ -1,34 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Actions - # The value of requests_per_second can be changed on a running delete by query using the _rethrottle API - # - # @option arguments [String] :task_id The task id to rethrottle (*Required*) - # @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html - # - def delete_by_query_rethrottle(arguments = {}) - raise ArgumentError, "Required argument 'task_id' missing" unless arguments[:task_id] - - method = Elasticsearch::API::HTTP_POST - path = "_delete_by_query/#{arguments[:task_id]}/_rethrottle" - params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - body = nil - - perform_request(method, path, params, body).body - end - - # Register this action with its valid params when the module is loaded. - # - # @since 6.2.0 - ParamsRegistry.register(:delete_by_query_rethrottle, [ - :requests_per_second - ].freeze) - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_index_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_index_template.rb deleted file mode 100644 index b0c480d163..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_index_template.rb +++ /dev/null @@ -1,45 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Indices - module Actions - # Deletes an index template. - # - # @option arguments [String] :name The name of the template - # @option arguments [Time] :timeout Explicit operation timeout - # @option arguments [Time] :master_timeout Specify timeout for connection to master - # @option arguments [Hash] :headers Custom HTTP headers - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html - # - def delete_index_template(arguments = {}) - raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] - - headers = arguments.delete(:headers) || {} - - arguments = arguments.clone - - _name = arguments.delete(:name) - - method = Elasticsearch::API::HTTP_DELETE - path = "_index_template/#{Utils.__listify(_name)}" - params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - - body = nil - perform_request(method, path, params, body, headers).body - end - - # Register this action with its valid params when the module is loaded. - # - # @since 6.2.0 - ParamsRegistry.register(:delete_index_template, [ - :timeout, - :master_timeout - ].freeze) -end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_streams.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_streams.rb index f9c2c6ba11..adc72921cd 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_streams.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_streams.rb @@ -8,7 +8,7 @@ module Indices module Actions # Returns data streams. # - # @option arguments [String] :name The name or wildcard expression of the requested data streams + # @option arguments [List] :name The comma separated names of data streams # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_index_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_index_template.rb deleted file mode 100644 index 97452f892b..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_index_template.rb +++ /dev/null @@ -1,49 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Indices - module Actions - # Returns an index template. - # - # @option arguments [List] :name The comma separated names of the index templates - # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) - # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node - # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) - # @option arguments [Hash] :headers Custom HTTP headers - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html - # - def get_index_template(arguments = {}) - headers = arguments.delete(:headers) || {} - - arguments = arguments.clone - - _name = arguments.delete(:name) - - method = Elasticsearch::API::HTTP_GET - path = if _name - "_index_template/#{Utils.__listify(_name)}" - else - "_index_template" - end - params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - - body = nil - perform_request(method, path, params, body, headers).body - end - - # Register this action with its valid params when the module is loaded. - # - # @since 6.2.0 - ParamsRegistry.register(:get_index_template, [ - :flat_settings, - :master_timeout, - :local - ].freeze) -end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_index_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_index_template.rb deleted file mode 100644 index eda3205c69..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_index_template.rb +++ /dev/null @@ -1,49 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Indices - module Actions - # Creates or updates an index template. - # - # @option arguments [String] :name The name of the template - # @option arguments [Number] :order The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) - # @option arguments [Boolean] :create Whether the index template should only be added if new or can also replace an existing one - # @option arguments [Time] :master_timeout Specify timeout for connection to master - # @option arguments [Hash] :headers Custom HTTP headers - # @option arguments [Hash] :body The template definition (*Required*) - # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html - # - def put_index_template(arguments = {}) - raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] - raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] - - headers = arguments.delete(:headers) || {} - - arguments = arguments.clone - - _name = arguments.delete(:name) - - method = Elasticsearch::API::HTTP_PUT - path = "_index_template/#{Utils.__listify(_name)}" - params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - - body = arguments[:body] - perform_request(method, path, params, body, headers).body - end - - # Register this action with its valid params when the module is loaded. - # - # @since 6.2.0 - ParamsRegistry.register(:put_index_template, [ - :order, - :create, - :master_timeout - ].freeze) -end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/nodes/shutdown.rb b/elasticsearch-api/lib/elasticsearch/api/actions/nodes/shutdown.rb deleted file mode 100644 index 2d2b30d347..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/nodes/shutdown.rb +++ /dev/null @@ -1,43 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Nodes - module Actions - # Shutdown one or all nodes - # - # @example Shut down node named _Bloke_ - # - # client.nodes.shutdown node_id: 'Bloke' - # - # @option arguments [List] :node_id A comma-separated list of node IDs or names to perform the operation on; use - # `_local` to shutdown the node you're connected to, leave empty to - # shutdown all nodes - # @option arguments [Time] :delay Set the delay for the operation (default: 1s) - # @option arguments [Boolean] :exit Exit the JVM as well (default: true) - # - # @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/ - # - def shutdown(arguments = {}) - method = HTTP_POST - path = Utils.__pathify '_cluster/nodes', Utils.__listify(arguments[:node_id]), '_shutdown' - - params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - body = nil - - perform_request(method, path, params, body).body - end - - # Register this action with its valid params when the module is loaded. - # - # @since 6.1.1 - ParamsRegistry.register(:shutdown, [ - :delay, - :exit - ].freeze) - end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/remote/info.rb b/elasticsearch-api/lib/elasticsearch/api/actions/remote/info.rb deleted file mode 100644 index c0856499a6..0000000000 --- a/elasticsearch-api/lib/elasticsearch/api/actions/remote/info.rb +++ /dev/null @@ -1,24 +0,0 @@ -# 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 - -module Elasticsearch - module API - module Remote - module Actions - # Returns all of the configured remote cluster information - # - # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html - # - def info(arguments = {}) - method = HTTP_GET - path = "_remote/info" - params = {} - body = nil - - perform_request(method, path, params, body).body - end - end - end - end -end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/tasks/cancel.rb b/elasticsearch-api/lib/elasticsearch/api/actions/tasks/cancel.rb index 50b3d2f557..4c5c59a077 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/tasks/cancel.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/tasks/cancel.rb @@ -12,7 +12,6 @@ module Actions # @option arguments [List] :nodes A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes # @option arguments [List] :actions A comma-separated list of actions that should be cancelled. Leave empty to cancel all. # @option arguments [String] :parent_task_id Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. - # @option arguments [Boolean] :wait_for_completion Should the request block until the cancellation of the task and its child tasks is completed. Defaults to false # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html @@ -42,8 +41,7 @@ def cancel(arguments = {}) ParamsRegistry.register(:cancel, [ :nodes, :actions, - :parent_task_id, - :wait_for_completion + :parent_task_id ].freeze) end end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/abort_benchmark_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/abort_benchmark_spec.rb deleted file mode 100644 index 92b8a17ec4..0000000000 --- a/elasticsearch-api/spec/elasticsearch/api/actions/abort_benchmark_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# 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 - -require 'spec_helper' - -describe 'client#abort_benchmark' do - - let(:expected_args) do - [ - 'POST', - '_bench/abort/foo', - {}, - nil - ] - end - - it 'performs the request' do - expect(client_double.abort_benchmark(name: 'foo')) - end -end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/benchmark_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/benchmark_spec.rb deleted file mode 100644 index 44e09d3386..0000000000 --- a/elasticsearch-api/spec/elasticsearch/api/actions/benchmark_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# 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 - -require 'spec_helper' - -describe 'client#benchmark' do - - let(:expected_args) do - [ - 'PUT', - '_bench', - {}, - { name: 'foo' } - ] - end - - it 'performs the request' do - expect(client_double.benchmark(body: { name: 'foo' })) - end -end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb deleted file mode 100644 index 57d8b3d62c..0000000000 --- a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb +++ /dev/null @@ -1,63 +0,0 @@ -# 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 - -require 'spec_helper' - -describe 'client.nodes#shutdown' do - - let(:expected_args) do - [ - 'POST', - url, - params, - nil, - nil - ] - end - - let(:url) do - '_cluster/nodes/_shutdown' - end - - it 'performs the request' do - expect(client_double.nodes.shutdown).to eq({}) - end - - let(:params) do - {} - end - - context 'when the node id is specified' do - - let(:url) do - '_cluster/nodes/foo/_shutdown' - end - - it 'performs the request' do - expect(client_double.nodes.shutdown(node_id: 'foo')).to eq({}) - end - end - - context 'when multiple node ids are specified as a list' do - - let(:url) do - '_cluster/nodes/A,B,C/_shutdown' - end - - it 'performs the request' do - expect(client_double.nodes.shutdown(node_id: ['A', 'B', 'C'])).to eq({}) - end - end - - context 'when multiple node ids are specified as a String' do - - let(:url) do - '_cluster/nodes/A,B,C/_shutdown' - end - - it 'performs the request' do - expect(client_double.nodes.shutdown(node_id: 'A,B,C')).to eq({}) - end - end -end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/remote/info_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/remote/info_spec.rb deleted file mode 100644 index 18f4290249..0000000000 --- a/elasticsearch-api/spec/elasticsearch/api/actions/remote/info_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# 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 - -require 'spec_helper' - -describe 'client.remote#info' do - - let(:expected_args) do - [ - 'GET', - '_remote/info', - {}, - nil, - nil - ] - end - - it 'performs the request' do - expect(client_double.remote.info).to eq({}) - end -end