elasticsearch 8.16.1 → 8.17.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: c1da188911e7b9929a793a87d64a8ea71affd01bcf0bbaa95ee327488f36b383
4
- data.tar.gz: dc779e3f3881c4a1a1fcdbbdaf657eaaf423a3139f4eeafd62f355616357e3ec
3
+ metadata.gz: 2bc62bd81721226fc8abc85dc8c3a0317925936d12b0ebd4dc71eb52b12be7c5
4
+ data.tar.gz: 6a14668e9228f1b2a1ba15368c34472d89b3454b888b428b6a4f38cadc6ece60
5
5
  SHA512:
6
- metadata.gz: 9d7d77a602139442943b1014687038a9f17e85cccb336dba71cb20eb4f5ba85eb1d21f078069186f08a00723d948626a47a886be2be3eb84b9158b3305e5ee1d
7
- data.tar.gz: ae8ec37c36fdec935169f49389cde45066ec8b09b36b3981961dd33e5cd3c7f2b530dd68bb3cd5b94171426c53672139be54fe1861afc4a94e469095f59711e1
6
+ metadata.gz: 299aa6b8e46fdcbb702bbd6a3c5a43e501f3b1507cdb06f8ce86aec8e886e32ee305111cfe38d2469cb34576ee25b6cf4e3d7e3c429603dd70b1ef7e882a404b
7
+ data.tar.gz: 78f47bcfcf7fd2133c825fb1b00ca20268e9fe65845cd73b35ac82e1e46f0985fba6598c85181215f8dce76435b1b7bf73b4c725d80e72771377e05d330683a1
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.required_ruby_version = '>= 2.5'
47
47
 
48
48
  s.add_dependency 'elastic-transport', '~> 8.3'
49
- s.add_dependency 'elasticsearch-api', '8.16.1'
49
+ s.add_dependency 'elasticsearch-api', '8.17.0'
50
50
 
51
51
  s.add_development_dependency 'base64'
52
52
  s.add_development_dependency 'bundler'
@@ -43,8 +43,12 @@ module Elasticsearch
43
43
  # @yieldparam document [Hash] yields a document found in the search hits.
44
44
  #
45
45
  def each(&block)
46
- until (docs = results).empty?
47
- docs.each(&block)
46
+ @docs = []
47
+ @scroll_id = nil
48
+ refresh_docs
49
+ for doc in @docs do
50
+ refresh_docs
51
+ yield doc
48
52
  end
49
53
  clear
50
54
  end
@@ -66,11 +70,17 @@ module Elasticsearch
66
70
  #
67
71
  def clear
68
72
  @client.clear_scroll(body: { scroll_id: @scroll_id }) if @scroll_id
69
- @scroll_id = nil
73
+ @docs = []
70
74
  end
71
75
 
72
76
  private
73
77
 
78
+ def refresh_docs
79
+ @docs ||= []
80
+ @docs << results
81
+ @docs.flatten!
82
+ end
83
+
74
84
  def initial_search
75
85
  response = @client.search(index: @index, scroll: @scroll, body: @body)
76
86
  @scroll_id = response['_scroll_id']
@@ -78,7 +88,7 @@ module Elasticsearch
78
88
  end
79
89
 
80
90
  def scroll_request
81
- @client.scroll(body: { scroll: @scroll, scroll_id: @scroll_id })['hits']['hits']
91
+ @client.scroll(body: {scroll: @scroll, scroll_id: @scroll_id})['hits']['hits']
82
92
  end
83
93
  end
84
94
  end
@@ -16,5 +16,5 @@
16
16
  # under the License.
17
17
 
18
18
  module Elasticsearch
19
- VERSION = '8.16.1'.freeze
19
+ VERSION = '8.17.0'.freeze
20
20
  end
@@ -18,66 +18,64 @@ require_relative 'helpers_spec_helper'
18
18
  require 'elasticsearch/helpers/scroll_helper'
19
19
 
20
20
  context 'Elasticsearch client helpers' do
21
- context 'ScrollHelper' do
22
- let(:index) { 'books' }
23
- let(:body) { { size: 12, query: { match_all: {} } } }
24
- let(:scroll_helper) { Elasticsearch::Helpers::ScrollHelper.new(client, index, body) }
21
+ let(:index) { 'books' }
22
+ let(:body) { { size: 12, query: { match_all: {} } } }
23
+ let(:scroll_helper) { Elasticsearch::Helpers::ScrollHelper.new(client, index, body) }
25
24
 
26
- before do
27
- documents = [
28
- { index: { _index: index, data: {name: "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561} } },
29
- { index: { _index: index, data: {name: "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482} } },
30
- { index: { _index: index, data: {name: "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604} } },
31
- { index: { _index: index, data: {name: "Dune Messiah", "author": "Frank Herbert", "release_date": "1969-10-15", "page_count": 331} } },
32
- { index: { _index: index, data: {name: "Children of Dune", "author": "Frank Herbert", "release_date": "1976-04-21", "page_count": 408} } },
33
- { index: { _index: index, data: {name: "God Emperor of Dune", "author": "Frank Herbert", "release_date": "1981-05-28", "page_count": 454} } },
34
- { index: { _index: index, data: {name: "Consider Phlebas", "author": "Iain M. Banks", "release_date": "1987-04-23", "page_count": 471} } },
35
- { index: { _index: index, data: {name: "Pandora's Star", "author": "Peter F. Hamilton", "release_date": "2004-03-02", "page_count": 768} } },
36
- { index: { _index: index, data: {name: "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585} } },
37
- { index: { _index: index, data: {name: "A Fire Upon the Deep", "author": "Vernor Vinge", "release_date": "1992-06-01", "page_count": 613} } },
38
- { index: { _index: index, data: {name: "Ender's Game", "author": "Orson Scott Card", "release_date": "1985-06-01", "page_count": 324} } },
39
- { index: { _index: index, data: {name: "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328} } },
40
- { index: { _index: index, data: {name: "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227} } },
41
- { index: { _index: index, data: {name: "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268} } },
42
- { index: { _index: index, data: {name: "Foundation", "author": "Isaac Asimov", "release_date": "1951-06-01", "page_count": 224} } },
43
- { index: { _index: index, data: {name: "The Giver", "author": "Lois Lowry", "release_date": "1993-04-26", "page_count": 208} } },
44
- { index: { _index: index, data: {name: "Slaughterhouse-Five", "author": "Kurt Vonnegut", "release_date": "1969-06-01", "page_count": 275} } },
45
- { index: { _index: index, data: {name: "The Hitchhiker's Guide to the Galaxy", "author": "Douglas Adams", "release_date": "1979-10-12", "page_count": 180} } },
46
- { index: { _index: index, data: {name: "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470} } },
47
- { index: { _index: index, data: {name: "Neuromancer", "author": "William Gibson", "release_date": "1984-07-01", "page_count": 271} } },
48
- { index: { _index: index, data: {name: "The Handmaid's Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311} } },
49
- { index: { _index: index, data: {name: "Starship Troopers", "author": "Robert A. Heinlein", "release_date": "1959-12-01", "page_count": 335} } },
50
- { index: { _index: index, data: {name: "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": "1969-06-01", "page_count": 304} } },
51
- { index: { _index: index, data: {name: "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288 } } }
52
- ]
53
- client.bulk(body: documents, refresh: 'wait_for')
54
- end
55
-
56
- after do
57
- client.indices.delete(index: index)
58
- end
25
+ before do
26
+ documents = [
27
+ { index: { _index: index, data: {name: "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561} } },
28
+ { index: { _index: index, data: {name: "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482} } },
29
+ { index: { _index: index, data: {name: "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604} } },
30
+ { index: { _index: index, data: {name: "Dune Messiah", "author": "Frank Herbert", "release_date": "1969-10-15", "page_count": 331} } },
31
+ { index: { _index: index, data: {name: "Children of Dune", "author": "Frank Herbert", "release_date": "1976-04-21", "page_count": 408} } },
32
+ { index: { _index: index, data: {name: "God Emperor of Dune", "author": "Frank Herbert", "release_date": "1981-05-28", "page_count": 454} } },
33
+ { index: { _index: index, data: {name: "Consider Phlebas", "author": "Iain M. Banks", "release_date": "1987-04-23", "page_count": 471} } },
34
+ { index: { _index: index, data: {name: "Pandora's Star", "author": "Peter F. Hamilton", "release_date": "2004-03-02", "page_count": 768} } },
35
+ { index: { _index: index, data: {name: "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585} } },
36
+ { index: { _index: index, data: {name: "A Fire Upon the Deep", "author": "Vernor Vinge", "release_date": "1992-06-01", "page_count": 613} } },
37
+ { index: { _index: index, data: {name: "Ender's Game", "author": "Orson Scott Card", "release_date": "1985-06-01", "page_count": 324} } },
38
+ { index: { _index: index, data: {name: "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328} } },
39
+ { index: { _index: index, data: {name: "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227} } },
40
+ { index: { _index: index, data: {name: "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268} } },
41
+ { index: { _index: index, data: {name: "Foundation", "author": "Isaac Asimov", "release_date": "1951-06-01", "page_count": 224} } },
42
+ { index: { _index: index, data: {name: "The Giver", "author": "Lois Lowry", "release_date": "1993-04-26", "page_count": 208} } },
43
+ { index: { _index: index, data: {name: "Slaughterhouse-Five", "author": "Kurt Vonnegut", "release_date": "1969-06-01", "page_count": 275} } },
44
+ { index: { _index: index, data: {name: "The Hitchhiker's Guide to the Galaxy", "author": "Douglas Adams", "release_date": "1979-10-12", "page_count": 180} } },
45
+ { index: { _index: index, data: {name: "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470} } },
46
+ { index: { _index: index, data: {name: "Neuromancer", "author": "William Gibson", "release_date": "1984-07-01", "page_count": 271} } },
47
+ { index: { _index: index, data: {name: "The Handmaid's Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311} } },
48
+ { index: { _index: index, data: {name: "Starship Troopers", "author": "Robert A. Heinlein", "release_date": "1959-12-01", "page_count": 335} } },
49
+ { index: { _index: index, data: {name: "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": "1969-06-01", "page_count": 304} } },
50
+ { index: { _index: index, data: {name: "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288 } } }
51
+ ]
52
+ client.bulk(body: documents, refresh: 'wait_for')
53
+ end
59
54
 
60
- it 'instantiates a scroll helper' do
61
- expect(scroll_helper).to be_an_instance_of Elasticsearch::Helpers::ScrollHelper
62
- end
55
+ after do
56
+ client.indices.delete(index: index)
57
+ end
63
58
 
64
- it 'searches an index' do
65
- my_documents = []
66
- while !(documents = scroll_helper.results).empty?
67
- my_documents << documents
68
- end
59
+ it 'instantiates a scroll helper' do
60
+ expect(scroll_helper).to be_an_instance_of Elasticsearch::Helpers::ScrollHelper
61
+ end
69
62
 
70
- expect(my_documents.flatten.size).to eq 24
63
+ it 'searches an index' do
64
+ my_documents = []
65
+ while !(documents = scroll_helper.results).empty?
66
+ my_documents << documents
71
67
  end
72
68
 
73
- it 'uses enumerable' do
74
- count = 0
75
- scroll_helper.each { count += 1 }
76
- expect(count).to eq 24
77
- expect(scroll_helper).to respond_to(:count)
78
- expect(scroll_helper).to respond_to(:reject)
79
- expect(scroll_helper).to respond_to(:uniq)
80
- expect(scroll_helper.map { |a| a['_id'] }.uniq.count).to eq 24
81
- end
69
+ expect(my_documents.flatten.size).to eq 24
70
+ end
71
+
72
+ it 'uses enumerable' do
73
+ count = 0
74
+ scroll_helper.each { |a| count += 1 }
75
+ expect(count).to eq 24
76
+ expect(scroll_helper).to respond_to(:count)
77
+ expect(scroll_helper).to respond_to(:reject)
78
+ expect(scroll_helper).to respond_to(:uniq)
79
+ expect(scroll_helper.map { |a| a['_id'] }.uniq.count).to eq 24
82
80
  end
83
81
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.16.1
4
+ version: 8.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-01-15 00:00:00.000000000 Z
11
+ date: 2024-12-11 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: elastic-transport
@@ -29,14 +30,14 @@ dependencies:
29
30
  requirements:
30
31
  - - '='
31
32
  - !ruby/object:Gem::Version
32
- version: 8.16.1
33
+ version: 8.17.0
33
34
  type: :runtime
34
35
  prerelease: false
35
36
  version_requirements: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - '='
38
39
  - !ruby/object:Gem::Version
39
- version: 8.16.1
40
+ version: 8.17.0
40
41
  - !ruby/object:Gem::Dependency
41
42
  name: base64
42
43
  requirement: !ruby/object:Gem::Requirement
@@ -240,6 +241,7 @@ metadata:
240
241
  changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/main/CHANGELOG.md
241
242
  source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/main
242
243
  bug_tracker_uri: https://github.com/elastic/elasticsearch-ruby/issues
244
+ post_install_message:
243
245
  rdoc_options:
244
246
  - "--charset=UTF-8"
245
247
  require_paths:
@@ -255,7 +257,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
257
  - !ruby/object:Gem::Version
256
258
  version: '0'
257
259
  requirements: []
258
- rubygems_version: 3.6.2
260
+ rubygems_version: 3.5.20
261
+ signing_key:
259
262
  specification_version: 4
260
263
  summary: Ruby integrations for Elasticsearch
261
264
  test_files: