opensearch-api 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 120d26d2c00900982e0318694e71ac6ad804b2f19ffe11539005b69eadf9775f
4
- data.tar.gz: 5beaf8317d9f30aedf3b05765f518cd7d2bb853192c0d7fc7ab86747fd1e8aad
3
+ metadata.gz: 832f3792a1ba90a36107ed481ce4a8d312788f0cc6d2499010fbb83f75310b3f
4
+ data.tar.gz: 8cd92be697d977c3e7dbb8e968f89c5e65c72d8780b825db470ae902a0a8fa4e
5
5
  SHA512:
6
- metadata.gz: daea96255b4d9a9ae424b03bb6ee49e1d6a62bc1a11e4cffcf50359e640350b22f37f0aa37ff5ed1fe069c1c5a313c2504e4b077308c6b19af3c34a4bff8898b
7
- data.tar.gz: e2aff66e8cfad49e553e708a5f77e0ad100e1d601006f4a9987901782ddb22e586c06cb125b14db9ca65defdfa50cd903c935b5d0a7abe6420408544d5bcb353
6
+ metadata.gz: 9af645120326fb0d4a4b3afe5dd063356c54eb02b4a813c2d3a86a6ffa4add32ec7c31291ade794d1fa4a229a6294d0882b58b92310746a783d170bd07c5147e
7
+ data.tar.gz: 65efd59ac74703fd6d6daf9ff04744e46cd962111821a6d9ede0653308c4563aa9171b0d6afb36e050e33a0bc56b8aff78358a1311d0743a1701ff661cfedc99
checksums.yaml.gz.sig CHANGED
Binary file
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .ruby-version
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
data/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # CHANGELOG
2
+ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3
+
4
+ ## [Unreleased]
5
+ ### Added
6
+ ### Changed
7
+ ### Deprecated
8
+ ### Removed
9
+ ### Fixed
10
+ ### Security
11
+
12
+ ## [2.2.0]
13
+ ### Added
14
+ - Added Point-In-Time API ([#136](https://github.com/opensearch-project/opensearch-ruby/issues/136))
15
+ ### Changed
16
+ ### Deprecated
17
+ ### Removed
18
+ - Removed Legacy X-Pack Point-In-Time API ([#136](https://github.com/opensearch-project/opensearch-ruby/issues/136))
19
+ ### Fixed
20
+ ### Security
21
+
22
+ ## 2.1.0
23
+ ### Changed
24
+ - Update comments around deprecated and inclusive naming ([#112](https://github.com/opensearch-project/opensearch-ruby/pull/112))
25
+ ### Removed
26
+ - Remove deprecated escape_utils ([#74](https://github.com/opensearch-project/opensearch-ruby/pull/74))
27
+ ### Fixed
28
+ - Fixing tests related to escape utils latest version ([#73](https://github.com/opensearch-project/opensearch-ruby/pull/73))
data/README.md CHANGED
@@ -1,193 +1,23 @@
1
- # OpenSearch::API
2
-
3
- **This library is part of the [`opensearch-ruby`](https://github.com/opensearch-project/opensearch-ruby/) package;
4
- please refer to it, unless you want to use this library standalone.**
5
-
6
- ----
7
-
8
- The `opensearch-api` library provides a Ruby implementation of
9
- the [OpenSearch](http://opensearch.com) REST API.
10
-
11
- It does not provide an OpenSearch client; see the
12
- [`opensearch-transport`](https://github.com/opensearch-project/opensearch-ruby/tree/main/opensearch-transport) library.
13
-
14
- The library is compatible with Ruby 1.9 and higher.
15
-
16
- It is compatible with OpenSearch's API versions from 1.0.0 till current.
17
-
18
- ## Installation
19
-
20
- Install the package from [Rubygems](https://rubygems.org):
21
-
22
- gem install opensearch-api
23
-
24
- To use an unreleased version, either add it to your `Gemfile` for [Bundler](http://gembundler.com):
25
-
26
- gem 'opensearch-api', git: 'git://github.com/opensearch-project/opensearch-ruby.git'
27
-
28
- or install it from a source code checkout:
29
-
30
- git clone https://github.com/opensearch-project/opensearch-ruby
31
- cd opensearch-ruby/opensearch-api
32
- bundle install
33
- rake install
34
-
35
- ## Usage
36
-
37
- The library is designed as a group of standalone Ruby modules, which can be mixed into a class
38
- providing connection to OpenSearch -- an OpenSearch client.
39
-
40
- ### Usage with the `opensearch` gem
41
-
42
- **When you use the client from the [`opensearch-ruby`](https://github.com/opensearch-project/opensearch-ruby/) package,
43
- the library modules have been already included**, so you just call the API methods:
44
-
45
- ```ruby
46
- require 'opensearch'
47
-
48
- client = OpenSearch::Client.new(log: true)
49
-
50
- client.index(index: 'myindex', id: 1, body: { title: 'Test' })
51
- # => {"_index"=>"myindex", ... "created"=>true}
52
-
53
- client.search(index: 'myindex', body: { query: { match: { title: 'test' } } })
54
- # => {"took"=>2, ..., "hits"=>{"total":5, ...}}
55
- ```
56
-
57
- ### Usage with a custom client
58
-
59
- When you want to mix the library into your own client, it must conform to a following _contract_:
60
-
61
- * It responds to a `perform_request(method, path, params, body, headers)` method,
62
- * the method returns an object with `status`, `body` and `headers` methods.
1
+ - [OpenSearch::API](#opensearchapi)
2
+ - [Compatibility](#compatibility)
3
+ - [User Guide](#user-guide)
4
+ - [License](#license)
63
5
 
64
- A simple client could look like this (_with a dependency on `active_support` to parse the query params_):
65
-
66
- ```ruby
67
- require 'multi_json'
68
- require 'faraday'
69
- require 'opensearch/api'
70
- require 'active_support'
71
-
72
- class MySimpleClient
73
- include OpenSearch::API
74
-
75
- CONNECTION = ::Faraday::Connection.new url: 'http://localhost:9200'
76
-
77
- def perform_request(method, path, params, body, headers = nil)
78
- puts "--> #{method.upcase} #{path} #{params} #{body} #{headers}"
79
-
80
- CONNECTION.run_request \
81
- method.downcase.to_sym,
82
- path_with_params(path, params),
83
- ( body ? MultiJson.dump(body): nil ),
84
- {'Content-Type' => 'application/json'}
85
- end
86
-
87
- private
88
-
89
- def path_with_params(path, params)
90
- return path if params.blank?
91
-
92
- case params
93
- when String
94
- "#{path}?#{params}"
95
- when Hash
96
- "#{path}?#{params.to_query}"
97
- else
98
- raise ArgumentError, "Cannot parse params: '#{params}'"
99
- end
100
- end
101
- end
102
-
103
- client = MySimpleClient.new
104
-
105
- p client.cluster.health
106
- # --> GET _cluster/health {}
107
- # => "{"cluster_name":"opensearch" ... }"
108
-
109
- p client.index index: 'myindex', id: 'custom', body: { title: "Indexing from my client" }
110
- # --> PUT myindex/mytype/custom {} {:title=>"Indexing from my client"}
111
- # => "{"ok":true, ... }"
112
- ```
113
-
114
- ### Using JSON Builders
115
-
116
- Instead of passing the `:body` argument as a Ruby _Hash_, you can pass it as a _String_, potentially
117
- taking advantage of JSON builders such as [JBuilder](https://github.com/rails/jbuilder) or
118
- [Jsonify](https://github.com/bsiggelkow/jsonify):
119
-
120
- ```ruby
121
- require 'jbuilder'
122
-
123
- query = Jbuilder.encode do |json|
124
- json.query do
125
- json.match do
126
- json.title do
127
- json.query 'test 1'
128
- json.operator 'and'
129
- end
130
- end
131
- end
132
- end
133
-
134
- client.search index: 'myindex', body: query
135
-
136
- # 2013-06-25 09:56:05 +0200: GET http://localhost:9200/myindex/_search [status:200, request:0.015s, query:0.011s]
137
- # 2013-06-25 09:56:05 +0200: > {"query":{"match":{"title":{"query":"test 1","operator":"and"}}}}
138
- # ...
139
- # => {"took"=>21, ..., "hits"=>{"total"=>1, "hits"=>[{ "_source"=>{"title"=>"Test 1", ...}}]}}
140
- ```
141
-
142
- ### Using Hash Wrappers
143
-
144
- For a more comfortable access to response properties, you may wrap it in one of the _Hash_ "object access"
145
- wrappers, such as [`Hashie::Mash`](https://github.com/intridea/hashie):
146
-
147
- ```ruby
148
- require 'hashie'
149
-
150
- response = client.search index: 'myindex',
151
- body: {
152
- query: { match: { title: 'test' } },
153
- aggregations: { tags: { terms: { field: 'tags' } } }
154
- }
155
-
156
- mash = Hashie::Mash.new response
157
-
158
- mash.hits.hits.first._source.title
159
- # => 'Test'
160
-
161
- mash.aggregations.tags.terms.first
162
- # => #<Hashie::Mash count=3 term="z">
163
- ```
164
-
165
- ### Using a Custom JSON Serializer
166
-
167
- The library uses the [MultiJson](https://rubygems.org/gems/multi_json/) gem by default,
168
- but allows you to set a custom JSON library, provided it uses the standard `load/dump`
169
- interface:
6
+ # OpenSearch::API
170
7
 
171
- ```ruby
172
- OpenSearch::API.settings[:serializer] = JrJackson::Json
173
- OpenSearch::API.serializer.dump({foo: 'bar'})
174
- # => {"foo":"bar"}
175
- ```
8
+ **This library is part of the [`opensearch-ruby`](https://github.com/opensearch-project/opensearch-ruby/) package; please refer to the [USER_GUIDE](../USER_GUIDE.md), unless you want to use this library standalone.**
176
9
 
177
- ## Development
10
+ The `opensearch-api` library provides a Ruby implementation of the OpenSearch REST APIs.
178
11
 
179
- To work on the code, clone and bootstrap the main repository first -- please see instructions in the main [README](../README.md#development).
12
+ It does not provide an OpenSearch client; see the [`opensearch-transport`](https://github.com/opensearch-project/opensearch-ruby/tree/main/opensearch-transport) library.
180
13
 
181
- To run tests, launch a testing cluster -- again, see instructions in the main [README](../README.md#development) -- and use the Rake tasks:
14
+ ## Compatibility
182
15
 
183
- ```
184
- time rake test:unit
185
- time rake test:integration
186
- ```
16
+ See [COMPATIBILITY](../COMPATIBILITY.md).
187
17
 
188
- We run the test suite for OpenSearch's Rest API tests.
18
+ ## User Guide
189
19
 
190
- The `rest_api` needs the test files from OpenSearch. You can run the rake task to download the test artifacts in the root folder of the project. This task needs a running cluster to determine which version and build hash of OpenSearch to use and test against. `TEST_OPENSEARCH_SERVER=http://localhost:9200 rake opensearch:download_artifacts`. This will download the necessary files used for the integration tests to `./tmp`.
20
+ See [USER_GUIDE](USER_GUIDE.md).
191
21
 
192
22
  ## License
193
23
 
data/Rakefile CHANGED
@@ -88,7 +88,7 @@ namespace :test do
88
88
  filename = 'tmp/artifacts.json'
89
89
  `curl -s <placeholder_opensearch_artifact_url> -o #{filename}`
90
90
 
91
- unless File.exists?("./#{filename}")
91
+ unless File.exist?("./#{filename}")
92
92
  STDERR.puts '[!] Couldn\'t download artifacts file'
93
93
  exit 1
94
94
  end
@@ -105,7 +105,7 @@ namespace :test do
105
105
  puts 'Downloading zip file:'
106
106
  `curl -s #{zip_url} -o tmp/#{filename}`
107
107
 
108
- unless File.exists?("./tmp/#{filename}")
108
+ unless File.exist?("./tmp/#{filename}")
109
109
  STDERR.puts '[!] Couldn\'t download artifact'
110
110
  exit 1
111
111
  end
data/USER_GUIDE.md ADDED
@@ -0,0 +1,155 @@
1
+ - [User Guide](#user-guide)
2
+ - [Installation](#installation)
3
+ - [Usage](#usage)
4
+ - [Usage with a custom client](#usage-with-a-custom-client)
5
+ - [Using JSON Builders](#using-json-builders)
6
+ - [Using Hash Wrappers](#using-hash-wrappers)
7
+ - [Using a Custom JSON Serializer](#using-a-custom-json-serializer)
8
+ - [Development](#development)
9
+
10
+ # User Guide
11
+ ## Installation
12
+
13
+ To add the gem to your project, install it using [RubyGems](https://rubygems.org/):
14
+
15
+ ```
16
+ gem install opensearch-api
17
+ ```
18
+
19
+ or add it to your Gemfile:
20
+ ```
21
+ gem opensearch-api
22
+ ```
23
+ and run:
24
+ ```
25
+ bundle install
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ The library is designed as a group of standalone Ruby modules, which can be mixed into a class providing connection to OpenSearch -- an OpenSearch client.
31
+
32
+ ### Usage with a custom client
33
+
34
+ To use the library with a custom client, it must conform to a following _contract_:
35
+
36
+ * It responds to a `perform_request(method, path, params, body, headers)` method.
37
+ * The method returns an object with `status`, `body` and `headers` methods.
38
+
39
+ A simple client could look like this (_with a dependency on `active_support` to parse the query params_):
40
+
41
+ ```ruby
42
+ require 'multi_json'
43
+ require 'faraday'
44
+ require 'opensearch/api'
45
+ require 'active_support'
46
+
47
+ class MySimpleClient
48
+ include OpenSearch::API
49
+
50
+ CONNECTION = ::Faraday::Connection.new url: 'http://localhost:9200'
51
+
52
+ def perform_request(method, path, params, body, headers = nil)
53
+ puts "--> #{method.upcase} #{path} #{params} #{body} #{headers}"
54
+
55
+ CONNECTION.run_request \
56
+ method.downcase.to_sym,
57
+ path_with_params(path, params),
58
+ ( body ? MultiJson.dump(body): nil ),
59
+ {'Content-Type' => 'application/json'}
60
+ end
61
+
62
+ private
63
+
64
+ def path_with_params(path, params)
65
+ return path if params.blank?
66
+
67
+ case params
68
+ when String
69
+ "#{path}?#{params}"
70
+ when Hash
71
+ "#{path}?#{params.to_query}"
72
+ else
73
+ raise ArgumentError, "Cannot parse params: '#{params}'"
74
+ end
75
+ end
76
+ end
77
+
78
+ client = MySimpleClient.new
79
+
80
+ p client.cluster.health
81
+
82
+ p client.index index: 'myindex', id: 'custom', body: { title: "Indexing from my client" }
83
+ ```
84
+
85
+ ### Using JSON Builders
86
+
87
+ Instead of passing the `:body` argument as a Ruby _Hash_, you can pass it as a _String_, potentially taking advantage of JSON builders such as [JBuilder](https://github.com/rails/jbuilder) or [Jsonify](https://github.com/bsiggelkow/jsonify):
88
+
89
+ ```ruby
90
+ require 'jbuilder'
91
+
92
+ query = Jbuilder.encode do |json|
93
+ json.query do
94
+ json.match do
95
+ json.title do
96
+ json.query 'test 1'
97
+ json.operator 'and'
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ client.search index: 'myindex', body: query
104
+ # 2013-06-25 09:56:05 +0200: GET http://localhost:9200/myindex/_search [status:200, request:0.015s, query:0.011s]
105
+ # 2013-06-25 09:56:05 +0200: > {"query":{"match":{"title":{"query":"test 1","operator":"and"}}}}
106
+ # ...
107
+ # => {"took"=>21, ..., "hits"=>{"total"=>1, "hits"=>[{ "_source"=>{"title"=>"Test 1", ...}}]}}
108
+ ```
109
+
110
+ ### Using Hash Wrappers
111
+
112
+ For a more comfortable access to response properties, you may wrap it in one of the _Hash_ "object access" wrappers, such as [`Hashie::Mash`](https://github.com/intridea/hashie):
113
+
114
+ ```ruby
115
+ require 'hashie'
116
+
117
+ response = client.search index: 'myindex',
118
+ body: {
119
+ query: { match: { title: 'test' } },
120
+ aggregations: { tags: { terms: { field: 'tags' } } }
121
+ }
122
+
123
+ mash = Hashie::Mash.new response
124
+
125
+ mash.hits.hits.first._source.title
126
+ # => 'test'
127
+
128
+ mash.aggregations.tags.terms.first
129
+ # => #<Hashie::Mash count=3 term="z">
130
+ ```
131
+
132
+ ### Using a Custom JSON Serializer
133
+
134
+ The library uses the [MultiJson](https://rubygems.org/gems/multi_json/) gem by default, but allows you to set a custom JSON library, provided it uses the standard `load/dump` interface:
135
+
136
+ ```ruby
137
+ OpenSearch::API.settings[:serializer] = JrJackson::Json
138
+ OpenSearch::API.serializer.dump({foo: 'bar'})
139
+ # => {"foo":"bar"}
140
+ ```
141
+
142
+ ## Development
143
+
144
+ To work on the code, clone and bootstrap the main repository first -- please see instructions in the main [DEVELOPER_GUIDE](../DEVELOPER_GUIDE.md).
145
+
146
+ To run tests:
147
+
148
+ ```
149
+ time rake test:unit
150
+ time rake test:integration
151
+ ```
152
+
153
+ We run the test suite for OpenSearch's Rest API tests.
154
+
155
+ The `rest_api` needs the test files from OpenSearch. You can run the rake task to download the test artifacts in the root folder of the project. This task needs a running cluster to determine which version and build hash of OpenSearch to use and test against. `TEST_OPENSEARCH_SERVER=http://localhost:9200 rake opensearch:download_artifacts`. This will download the necessary files used for the integration tests to `./tmp`.
@@ -0,0 +1,46 @@
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
+ module OpenSearch
11
+ module API
12
+ module Cat
13
+ module Actions
14
+ # Retrieves info of all PIT segments
15
+ #
16
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
17
+ # @option arguments [List] :h Comma-separated list of column names to display
18
+ # @option arguments [Boolean] :help Return help information
19
+ # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
20
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
21
+ # @option arguments [Hash] :headers Custom HTTP headers
22
+ def all_pit_segments(arguments = {})
23
+ arguments = arguments.clone
24
+ headers = arguments.delete(:headers) || {}
25
+
26
+
27
+ method = OpenSearch::API::HTTP_GET
28
+ path = '_cat/pit_segments/_all'
29
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
30
+ params[:h] = Utils.__listify(params[:h]) if params[:h]
31
+
32
+ body = nil
33
+ perform_request(method, path, params, body, headers).body
34
+ end
35
+
36
+ ParamsRegistry.register(:all_pit_segments, [
37
+ :format,
38
+ :h,
39
+ :help,
40
+ :s,
41
+ :v
42
+ ].freeze)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,49 @@
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
+ module OpenSearch
11
+ module API
12
+ module Cat
13
+ module Actions
14
+ # Retrieves info of certain PIT segments
15
+ #
16
+ # @option arguments [Hash] body: Must include `pit_id`, which is an array of PIT IDs. (required)
17
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
18
+ # @option arguments [List] :h Comma-separated list of column names to display
19
+ # @option arguments [Boolean] :help Return help information
20
+ # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
21
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
22
+ # @option arguments [Hash] :headers Custom HTTP headers
23
+ def pit_segments(arguments = {})
24
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
25
+
26
+ arguments = arguments.clone
27
+ headers = arguments.delete(:headers) || {}
28
+
29
+
30
+ method = OpenSearch::API::HTTP_GET
31
+ path = '_cat/pit_segments'
32
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
33
+ params[:h] = Utils.__listify(params[:h]) if params[:h]
34
+
35
+ body = arguments[:body]
36
+ perform_request(method, path, params, body, headers).body
37
+ end
38
+
39
+ ParamsRegistry.register(:pit_segments, [
40
+ :format,
41
+ :h,
42
+ :help,
43
+ :s,
44
+ :v
45
+ ].freeze)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,45 @@
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
+ module OpenSearch
11
+ module API
12
+ module Actions
13
+ # Creates a point in time.
14
+ #
15
+ # @option arguments [String] :index The name(s) of the target index(es) for the PIT. May contain a comma-separated list or a wildcard index pattern. (required)
16
+ # @option arguments [String] :keep_alive The amount of time to keep the PIT. (required)
17
+ # @option arguments [String] :preference The node or the shard used to perform the search. (default: random)
18
+ # @option arguments [String] :routing Specifies to route search requests to a specific shard.
19
+ # @option arguments [String] :expand_wildcards The type of index that can match the wildcard pattern. Supports comma-separated values. (default: open)
20
+ # @option arguments [String] :allow_partial_pit_creation Specifies whether to create a PIT with partial failures. (default: false)
21
+ def create_pit(arguments = {})
22
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
23
+ raise ArgumentError, "Required argument 'keep_alive' missing" unless arguments[:keep_alive]
24
+
25
+ arguments = arguments.clone
26
+ _index = arguments.delete(:index)
27
+
28
+ method = OpenSearch::API::HTTP_POST
29
+ path = "#{Utils.__listify(_index)}/_search/point_in_time"
30
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
31
+ body = nil
32
+
33
+ perform_request(method, path, params, body).body
34
+ end
35
+
36
+ ParamsRegistry.register(:create_pit, [
37
+ :keep_alive,
38
+ :preference,
39
+ :routing,
40
+ :expand_wildcards,
41
+ :allow_partial_pit_creation
42
+ ].freeze)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,26 @@
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
+ module OpenSearch
11
+ module API
12
+ module Actions
13
+ # Deletes all PITs.
14
+ def delete_all_pits(arguments = {})
15
+ method = OpenSearch::API::HTTP_DELETE
16
+ path = "_search/point_in_time/_all"
17
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
18
+ body = nil
19
+
20
+ perform_request(method, path, params, body).body
21
+ end
22
+
23
+ ParamsRegistry.register(:delete_all_pits, [].freeze)
24
+ end
25
+ end
26
+ end
@@ -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
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ module OpenSearch
11
+ module API
12
+ module Actions
13
+ # Deletes one or several PITs.
14
+ #
15
+ # @option arguments [Hash] body: Must include `pit_id`, which is an array of PIT IDs to be deleted. (required)
16
+ def delete_pit(arguments = {})
17
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
18
+
19
+ method = OpenSearch::API::HTTP_DELETE
20
+ path = "_search/point_in_time"
21
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
22
+ body = arguments[:body]
23
+
24
+ perform_request(method, path, params, body).body
25
+ end
26
+
27
+ ParamsRegistry.register(:delete_pit, [].freeze)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,26 @@
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
+ module OpenSearch
11
+ module API
12
+ module Actions
13
+ # Gets all PITs.
14
+ def get_all_pits(arguments = {})
15
+ method = OpenSearch::API::HTTP_GET
16
+ path = "_search/point_in_time/_all"
17
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
18
+ body = nil
19
+
20
+ perform_request(method, path, params, body).body
21
+ end
22
+
23
+ ParamsRegistry.register(:get_all_pits, [].freeze)
24
+ end
25
+ end
26
+ end
@@ -26,6 +26,6 @@
26
26
 
27
27
  module OpenSearch
28
28
  module API
29
- VERSION = '2.1.0'.freeze
29
+ VERSION = '2.2.0'.freeze
30
30
  end
31
31
  end