opensearch-ruby 3.1.0 → 3.3.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: 3c9fdb7a7db88f76450b0e373a298a2246d6553705ca3692e10f40137b413f5c
4
- data.tar.gz: 8b83c460d6f2104464423c7d8c757be42128af498eb3fc7d838455fc65a04203
3
+ metadata.gz: 4df9e2bb2805922ffea24e6e5f19e9fd5da1144a19ae69897320d02a08ce4d45
4
+ data.tar.gz: 366a83a83650c80e2dd991917c2681c94c71406813446ce607e73c23c5b30def
5
5
  SHA512:
6
- metadata.gz: e23fad0916d26017323185c0b6f44067724deb5e66a0b849ebf042e90342f6941033bea8903b7eeac7f7eadbf1b35998d6f366c3187659c6194684c730908a49
7
- data.tar.gz: a2c5a7945ef0442eb9e725fede191d37cefa04625c716400528322fa638ad5899e7e8b77f03de73511dabfa252aff4c0564e9f7f52852761020ba5958a949eab
6
+ metadata.gz: f032360a5c22d9a14eeb9f15317d1d634260a08bc55f49c2a230ffbba9419e458800082033d7b18cab74bf29df866f0c9e994f9c2483154f5988653e8187f920
7
+ data.tar.gz: 58a70490e2441dce32b5844632c7a9eafb235805cdcec0927c80d8514ea8cdb2b71fbee4061fbb88aeae05038a024af359e917ee76c1cbd1778dcfdc187f08c2
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
@@ -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
@@ -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
@@ -250,7 +250,7 @@ module OpenSearch
250
250
  end
251
251
 
252
252
  def respond_to_missing?(method_name, include_private = false)
253
- @options.respond_to?(name) || super
253
+ @options.respond_to?(method_name) || super
254
254
  end
255
255
 
256
256
  # Converts the search definition to a Hash
@@ -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
@@ -25,5 +25,5 @@
25
25
  # under the License.
26
26
 
27
27
  module OpenSearch
28
- VERSION = '3.1.0'.freeze
28
+ VERSION = '3.3.0'.freeze
29
29
  end
data/lib/opensearch.rb CHANGED
@@ -49,7 +49,7 @@ module OpenSearch
49
49
  end
50
50
 
51
51
  def respond_to_missing?(method_name, include_private = false)
52
- name == :perform_request || super
52
+ method_name == :perform_request || super
53
53
  end
54
54
 
55
55
  private
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.1.0
4
+ version: 3.3.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-12-12 00:00:00.000000000 Z
34
+ date: 2024-04-30 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
@@ -540,7 +539,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
540
539
  - !ruby/object:Gem::Version
541
540
  version: '0'
542
541
  requirements: []
543
- rubygems_version: 3.3.26
542
+ rubygems_version: 3.3.27
544
543
  signing_key:
545
544
  specification_version: 4
546
545
  summary: Ruby Client for OpenSearch
metadata.gz.sig CHANGED
Binary file
@@ -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