opensearch-ruby 3.0.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acfe78362c6e8419468eee1d2e0ed0810e85d6ef32b437b0f4f9ddfe92bb079d
4
- data.tar.gz: 439186758b24c9793796122a1ed77495f0849dac72b1fa7ffaaa68f2619ea56d
3
+ metadata.gz: 419497e48fbb6859275f24629079b21861fcca68bebb7f91254e8d912e216ced
4
+ data.tar.gz: 4de9071cd2a940c459864ddc4e89fa27e837ce74f3cfd3cfa719ac2ef3f534a5
5
5
  SHA512:
6
- metadata.gz: 9447ff69ca3872f90ba4a22bcff45f4002ab4f7e49bfdc6905d78a33be55522fcc855f1d31722d0c27ddc86448d6911489148cd326393c2dcc22e5ca542be591
7
- data.tar.gz: '016245184b5d758b4712dd9b9307189ce3310628cfaad9db5ca774ac7b1e5b5114f8216bb95e2a1511f498112120878b75d2f86065ac94677d27307bf38e32ac'
6
+ metadata.gz: df16ea05cb84a645a968ba8c4431b7be168fbaa47c841d02acd2015f46b82b57f7ebf3b8cea3e70b886379fe4ac2e6d73d79e92009baf85ac563a52f1806c5bf
7
+ data.tar.gz: f63990cbb5dc776c28aa88ff2e53db4861e75be8c97595784e2a7dd25ad9b4990e0878c90d5f831f3fe7d07a046f6577d98766b1e793cf8ef5ee60f4d4dc7768
checksums.yaml.gz.sig CHANGED
Binary file
data/USER_GUIDE.md CHANGED
@@ -13,8 +13,8 @@ To add the client to your project, install it using [RubyGems](https://rubygems.
13
13
  `gem install opensearch-ruby`
14
14
 
15
15
  or add it to your Gemfile:
16
- ```
17
- gem opensearch-ruby
16
+ ```ruby
17
+ gem 'opensearch-ruby'
18
18
  ```
19
19
  and run:
20
20
  ```
@@ -23,7 +23,9 @@ bundle install
23
23
 
24
24
  Import the client:
25
25
 
26
- `require 'opensearch'`
26
+ ```ruby
27
+ require 'opensearch'
28
+ ```
27
29
 
28
30
  ## Basic Usage
29
31
  ```ruby
@@ -138,6 +140,7 @@ response = client.search index: index_name, body: search {
138
140
  - [Advanced Index Actions](guides/advanced_index_actions.md)
139
141
  - [Index Templates](guides/index_template.md)
140
142
  - [Transport Options](guides/transport_options.md)
143
+ - [Custom HTTP Requests](guides/json.md)
141
144
 
142
145
  ## Amazon OpenSearch Service
143
146
 
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized CONNECT request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def connect(url, headers: {}, body: nil, params: {})
23
+ request('CONNECT', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized DELETE request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def delete(url, headers: {}, body: nil, params: {})
23
+ request('DELETE', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized GET request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def get(url, headers: {}, body: nil, params: {})
23
+ request('GET', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized HEAD request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def head(url, headers: {}, body: nil, params: {})
23
+ request('HEAD', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized OPTIONS request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def options(url, headers: {}, body: nil, params: {})
23
+ request('OPTIONS', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized PATCH request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def patch(url, headers: {}, body: nil, params: {})
23
+ request('PATCH', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized POST request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def post(url, headers: {}, body: nil, params: {})
23
+ request('POST', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized PUT request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def put(url, headers: {}, body: nil, params: {})
23
+ request('PUT', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ private
17
+
18
+ def request(method, url, headers: {}, body: nil, params: {})
19
+ body = OpenSearch::API::Utils.__bulkify(body) if body.is_a?(Array)
20
+ headers.merge!('Content-Type' => 'application/x-ndjson') if body.is_a?(Array)
21
+
22
+ perform_request(method, url, params, body, headers).body
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions
16
+ # Make a customized TRACE request.
17
+ #
18
+ # @option arguments [String] :url Relative path to the endpoint (e.g. 'cat/indices/books,movies') (*Required*)
19
+ # @option arguments [Hash] :params Querystring parameters to be appended to the path
20
+ # @option arguments [Hash] :headers Custom HTTP headers
21
+ # @option arguments [String | Hash | Array<Hash>] :body The body of the request
22
+ def trace(url, headers: {}, body: nil, params: {})
23
+ request('TRACE', url, headers: headers, body: body, params: params)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -48,6 +48,7 @@ module OpenSearch
48
48
  # @option arguments [String] :q Query in the Lucene query string syntax
49
49
  # @option arguments [List] :routing A comma-separated list of specific routing values
50
50
  # @option arguments [Time] :scroll Specify how long a consistent view of the index should be maintained for scrolled search
51
+ # @option arguments [String] :search_pipeline Customizable sequence of processing stages applied to search queries.
51
52
  # @option arguments [String] :search_type Search operation type (options: query_then_fetch, dfs_query_then_fetch)
52
53
  # @option arguments [Number] :size Number of hits to return (default: 10)
53
54
  # @option arguments [List] :sort A comma-separated list of <field>:<direction> pairs
@@ -128,6 +129,7 @@ module OpenSearch
128
129
  q
129
130
  routing
130
131
  scroll
132
+ search_pipeline
131
133
  search_type
132
134
  size
133
135
  sort
@@ -0,0 +1,30 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+
7
+ # This code was generated from OpenSearch API Spec.
8
+ # Update the code generation logic instead of modifying this file directly.
9
+
10
+ # frozen_string_literal: true
11
+
12
+ module OpenSearch
13
+ module API
14
+ module Http
15
+ module Actions; end
16
+
17
+ # Client for the "http" namespace (includes the Http::Actions methods)
18
+ class HttpClient
19
+ include Http::Actions
20
+ include Common::Client
21
+ include Common::Client::Base
22
+ end
23
+
24
+ # Proxy method for HttpClient, available in the receiving object
25
+ def http
26
+ @http ||= HttpClient.new(self)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -79,6 +79,7 @@ module OpenSearch
79
79
  OpenSearch::API::Cluster,
80
80
  OpenSearch::API::DanglingIndices,
81
81
  OpenSearch::API::Features,
82
+ OpenSearch::API::Http,
82
83
  OpenSearch::API::Indices,
83
84
  OpenSearch::API::Ingest,
84
85
  OpenSearch::API::Nodes,
@@ -55,10 +55,10 @@ module OpenSearch
55
55
  define_method name do |*args|
56
56
  @hash[name] = args.pop
57
57
  end
58
+ end
58
59
 
59
- define_method name.to_s.gsub(/^_(.*)/, '\1') do |*args|
60
- @hash[name] = args.pop
61
- end
60
+ def source(*args)
61
+ @hash[:_source] = args.pop
62
62
  end
63
63
 
64
64
  # Returns true when there are no search options defined
@@ -59,7 +59,6 @@ module OpenSearch
59
59
  option_method :lenient
60
60
  option_method :zero_terms_query
61
61
  option_method :cutoff_frequency
62
- option_method :max_expansions
63
62
  end
64
63
  end
65
64
  end
@@ -24,8 +24,6 @@
24
24
  # specific language governing permissions and limitations
25
25
  # under the License.
26
26
 
27
- require 'base64'
28
-
29
27
  module OpenSearch
30
28
  module Transport
31
29
  # Handles communication with an OpenSearch cluster.
@@ -225,7 +223,8 @@ module OpenSearch
225
223
  return unless arguments[:cloud_id] && !arguments[:cloud_id].empty?
226
224
 
227
225
  name = arguments[:cloud_id].split(':')[0]
228
- cloud_url, opensearch_instance = Base64.decode64(arguments[:cloud_id].gsub("#{name}:", '')).split('$')
226
+ base64_decoded = arguments[:cloud_id].gsub("#{name}:", '').unpack1('m')
227
+ cloud_url, opensearch_instance = base64_decoded.split('$')
229
228
 
230
229
  if cloud_url.include?(':')
231
230
  url, port = cloud_url.split(':')
@@ -355,7 +354,8 @@ module OpenSearch
355
354
  # Encode credentials for the Authorization Header
356
355
  # Credentials is the base64 encoding of id and api_key joined by a colon
357
356
  def __encode(api_key)
358
- Base64.strict_encode64([api_key[:id], api_key[:api_key]].join(':'))
357
+ joined = [api_key[:id], api_key[:api_key]].join(':')
358
+ [joined].pack('m0')
359
359
  end
360
360
  end
361
361
  end
@@ -104,9 +104,7 @@ module OpenSearch
104
104
  # @see Sniffer#hosts
105
105
  #
106
106
  def reload_connections!
107
- puts hosts
108
107
  hosts = sniffer.hosts
109
- puts hosts
110
108
  __rebuild_connections hosts: hosts, options: options
111
109
  self
112
110
  rescue SnifferTimeoutError
@@ -39,7 +39,7 @@ module OpenSearch
39
39
  @status = status
40
40
  @body = body
41
41
  @headers = headers
42
- @body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
42
+ @body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding) && body.encoding != Encoding::UTF_8
43
43
  end
44
44
  end
45
45
  end
@@ -25,5 +25,5 @@
25
25
  # under the License.
26
26
 
27
27
  module OpenSearch
28
- VERSION = '3.0.1'.freeze
28
+ VERSION = '3.2.0'.freeze
29
29
  end
@@ -28,8 +28,7 @@ require_relative '../test_helper'
28
28
 
29
29
  class OpenSearch::Transport::Transport::ResponseTest < Minitest::Test
30
30
  context "Response" do
31
-
32
- should "force-encode the body into UTF" do
31
+ should "force-encode the body into UTF-8" do
33
32
  body = "Hello Encoding!".encode(Encoding::ISO_8859_1)
34
33
  assert_equal 'ISO-8859-1', body.encoding.name
35
34
 
@@ -37,5 +36,11 @@ class OpenSearch::Transport::Transport::ResponseTest < Minitest::Test
37
36
  assert_equal 'UTF-8', response.body.encoding.name
38
37
  end
39
38
 
39
+ should "not force-encode the body if it is already encoded as UTF-8" do
40
+ body = "Hello Frozen!".freeze
41
+ response = OpenSearch::Transport::Transport::Response.new 200, body
42
+
43
+ assert_equal body, response.body
44
+ end
40
45
  end
41
46
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensearch-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
@@ -31,7 +31,7 @@ cert_chain:
31
31
  1DlemA1SsUBIoF7CwtVd/RTG/K1iT6nBD08fdKxodMhI5ujkP3N7gkxzRf6aKN4z
32
32
  glnDJYZjluKBUsKTOLdPW1CZpb0AHLpNqDf8SVHsPFk=
33
33
  -----END CERTIFICATE-----
34
- date: 2023-09-19 00:00:00.000000000 Z
34
+ date: 2024-04-16 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: faraday
@@ -143,7 +143,6 @@ files:
143
143
  - lib/opensearch/api/actions/delete_all_pits.rb
144
144
  - lib/opensearch/api/actions/delete_by_query.rb
145
145
  - lib/opensearch/api/actions/delete_by_query_rethrottle.rb
146
- - lib/opensearch/api/actions/delete_by_rethrottle.rb
147
146
  - lib/opensearch/api/actions/delete_pit.rb
148
147
  - lib/opensearch/api/actions/delete_script.rb
149
148
  - lib/opensearch/api/actions/exists.rb
@@ -159,6 +158,16 @@ files:
159
158
  - lib/opensearch/api/actions/get_script_context.rb
160
159
  - lib/opensearch/api/actions/get_script_languages.rb
161
160
  - lib/opensearch/api/actions/get_source.rb
161
+ - lib/opensearch/api/actions/http/connect.rb
162
+ - lib/opensearch/api/actions/http/delete.rb
163
+ - lib/opensearch/api/actions/http/get.rb
164
+ - lib/opensearch/api/actions/http/head.rb
165
+ - lib/opensearch/api/actions/http/options.rb
166
+ - lib/opensearch/api/actions/http/patch.rb
167
+ - lib/opensearch/api/actions/http/post.rb
168
+ - lib/opensearch/api/actions/http/put.rb
169
+ - lib/opensearch/api/actions/http/request.rb
170
+ - lib/opensearch/api/actions/http/trace.rb
162
171
  - lib/opensearch/api/actions/index.rb
163
172
  - lib/opensearch/api/actions/indices/add_block.rb
164
173
  - lib/opensearch/api/actions/indices/analyze.rb
@@ -318,6 +327,7 @@ files:
318
327
  - lib/opensearch/api/namespace/common.rb
319
328
  - lib/opensearch/api/namespace/dangling_indices.rb
320
329
  - lib/opensearch/api/namespace/features.rb
330
+ - lib/opensearch/api/namespace/http.rb
321
331
  - lib/opensearch/api/namespace/indices.rb
322
332
  - lib/opensearch/api/namespace/ingest.rb
323
333
  - lib/opensearch/api/namespace/nodes.rb
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- �H���5L�۹/���c��^�y?��#W��X%ˬ��+i]�4UiL�)=k_���
2
- nt���05
1
+ %
2
+ �>fj�L+<F�Z�$��@�,OFfy��~��!q�
3
+
@@ -1,55 +0,0 @@
1
- # SPDX-License-Identifier: Apache-2.0
2
- #
3
- # The OpenSearch Contributors require contributions made to
4
- # this file be licensed under the Apache-2.0 license or a
5
- # compatible open source license.
6
- #
7
- # Modifications Copyright OpenSearch Contributors. See
8
- # GitHub history for details.
9
- #
10
- # Licensed to Elasticsearch B.V. under one or more contributor
11
- # license agreements. See the NOTICE file distributed with
12
- # this work for additional information regarding copyright
13
- # ownership. Elasticsearch B.V. licenses this file to you under
14
- # the Apache License, Version 2.0 (the "License"); you may
15
- # not use this file except in compliance with the License.
16
- # You may obtain a copy of the License at
17
- #
18
- # http://www.apache.org/licenses/LICENSE-2.0
19
- #
20
- # Unless required by applicable law or agreed to in writing,
21
- # software distributed under the License is distributed on an
22
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
- # KIND, either express or implied. See the License for the
24
- # specific language governing permissions and limitations
25
- # under the License.
26
-
27
- module OpenSearch
28
- module API
29
- module Actions
30
- # The value of requests_per_second can be changed on a running delete by query using the _rethrottle API
31
- #
32
- # @option arguments [String] :task_id The task id to rethrottle (*Required*)
33
- # @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
34
- #
35
- #
36
- def delete_by_query_rethrottle(arguments = {})
37
- raise ArgumentError, "Required argument 'task_id' missing" unless arguments[:task_id]
38
-
39
- method = OpenSearch::API::HTTP_POST
40
- path = "_delete_by_query/#{arguments[:task_id]}/_rethrottle"
41
- params = OpenSearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
42
- body = nil
43
-
44
- perform_request(method, path, params, body).body
45
- end
46
-
47
- # Register this action with its valid params when the module is loaded.
48
- #
49
- # @since 6.2.0
50
- ParamsRegistry.register(:delete_by_query_rethrottle, [
51
- :requests_per_second
52
- ].freeze)
53
- end
54
- end
55
- end