opensearch-ruby 3.0.1 → 3.1.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/USER_GUIDE.md +1 -0
- data/lib/opensearch/api/actions/http/connect.rb +28 -0
- data/lib/opensearch/api/actions/http/delete.rb +28 -0
- data/lib/opensearch/api/actions/http/get.rb +28 -0
- data/lib/opensearch/api/actions/http/head.rb +28 -0
- data/lib/opensearch/api/actions/http/options.rb +28 -0
- data/lib/opensearch/api/actions/http/patch.rb +28 -0
- data/lib/opensearch/api/actions/http/post.rb +28 -0
- data/lib/opensearch/api/actions/http/put.rb +28 -0
- data/lib/opensearch/api/actions/http/request.rb +27 -0
- data/lib/opensearch/api/actions/http/trace.rb +28 -0
- data/lib/opensearch/api/namespace/http.rb +30 -0
- data/lib/opensearch/api.rb +1 -0
- data/lib/opensearch/transport/transport/response.rb +1 -1
- data/lib/opensearch/version.rb +1 -1
- data/test/transport/unit/response_test.rb +7 -2
- data.tar.gz.sig +0 -0
- metadata +13 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c9fdb7a7db88f76450b0e373a298a2246d6553705ca3692e10f40137b413f5c
|
4
|
+
data.tar.gz: 8b83c460d6f2104464423c7d8c757be42128af498eb3fc7d838455fc65a04203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e23fad0916d26017323185c0b6f44067724deb5e66a0b849ebf042e90342f6941033bea8903b7eeac7f7eadbf1b35998d6f366c3187659c6194684c730908a49
|
7
|
+
data.tar.gz: a2c5a7945ef0442eb9e725fede191d37cefa04625c716400528322fa638ad5899e7e8b77f03de73511dabfa252aff4c0564e9f7f52852761020ba5958a949eab
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/USER_GUIDE.md
CHANGED
@@ -138,6 +138,7 @@ response = client.search index: index_name, body: search {
|
|
138
138
|
- [Advanced Index Actions](guides/advanced_index_actions.md)
|
139
139
|
- [Index Templates](guides/index_template.md)
|
140
140
|
- [Transport Options](guides/transport_options.md)
|
141
|
+
- [Custom HTTP Requests](guides/json.md)
|
141
142
|
|
142
143
|
## Amazon OpenSearch Service
|
143
144
|
|
@@ -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
|
@@ -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
|
data/lib/opensearch/api.rb
CHANGED
@@ -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
|
data/lib/opensearch/version.rb
CHANGED
@@ -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
|
4
|
+
version: 3.1.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-
|
34
|
+
date: 2023-12-12 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: faraday
|
@@ -159,6 +159,16 @@ files:
|
|
159
159
|
- lib/opensearch/api/actions/get_script_context.rb
|
160
160
|
- lib/opensearch/api/actions/get_script_languages.rb
|
161
161
|
- lib/opensearch/api/actions/get_source.rb
|
162
|
+
- lib/opensearch/api/actions/http/connect.rb
|
163
|
+
- lib/opensearch/api/actions/http/delete.rb
|
164
|
+
- lib/opensearch/api/actions/http/get.rb
|
165
|
+
- lib/opensearch/api/actions/http/head.rb
|
166
|
+
- lib/opensearch/api/actions/http/options.rb
|
167
|
+
- lib/opensearch/api/actions/http/patch.rb
|
168
|
+
- lib/opensearch/api/actions/http/post.rb
|
169
|
+
- lib/opensearch/api/actions/http/put.rb
|
170
|
+
- lib/opensearch/api/actions/http/request.rb
|
171
|
+
- lib/opensearch/api/actions/http/trace.rb
|
162
172
|
- lib/opensearch/api/actions/index.rb
|
163
173
|
- lib/opensearch/api/actions/indices/add_block.rb
|
164
174
|
- lib/opensearch/api/actions/indices/analyze.rb
|
@@ -318,6 +328,7 @@ files:
|
|
318
328
|
- lib/opensearch/api/namespace/common.rb
|
319
329
|
- lib/opensearch/api/namespace/dangling_indices.rb
|
320
330
|
- lib/opensearch/api/namespace/features.rb
|
331
|
+
- lib/opensearch/api/namespace/http.rb
|
321
332
|
- lib/opensearch/api/namespace/indices.rb
|
322
333
|
- lib/opensearch/api/namespace/ingest.rb
|
323
334
|
- lib/opensearch/api/namespace/nodes.rb
|
metadata.gz.sig
CHANGED
Binary file
|