elasticsearch 8.17.0 → 8.17.1

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: 2bc62bd81721226fc8abc85dc8c3a0317925936d12b0ebd4dc71eb52b12be7c5
4
- data.tar.gz: 6a14668e9228f1b2a1ba15368c34472d89b3454b888b428b6a4f38cadc6ece60
3
+ metadata.gz: cf84137dc62acb113548d68d0c2bfd992454cb1c17038fd09d238f014be94d2b
4
+ data.tar.gz: 79de1d7246e86f27c5cb4d7376371759821512e00405d91e881209c25a7d4c23
5
5
  SHA512:
6
- metadata.gz: 299aa6b8e46fdcbb702bbd6a3c5a43e501f3b1507cdb06f8ce86aec8e886e32ee305111cfe38d2469cb34576ee25b6cf4e3d7e3c429603dd70b1ef7e882a404b
7
- data.tar.gz: 78f47bcfcf7fd2133c825fb1b00ca20268e9fe65845cd73b35ac82e1e46f0985fba6598c85181215f8dce76435b1b7bf73b4c725d80e72771377e05d330683a1
6
+ metadata.gz: 91410ddf042f5ad1ca837dcf3c95935c47005a2756f832dd450c3dc740941b04e4f70534191dd73662923c0e054c9d17ef6cbe251c368872dcac65d904888e1c
7
+ data.tar.gz: 2357dbe0f1811ac05729c2e7b542e900d822aba1064d8672ddc203f694772afbbbfa7f04c743fb614b3a8b0eaf8268b7a6fb1d2ff1271730ce08f25e5de32dc6
@@ -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.17.0'
49
+ s.add_dependency 'elasticsearch-api', '8.17.1'
50
50
 
51
51
  s.add_development_dependency 'base64'
52
52
  s.add_development_dependency 'bundler'
@@ -43,12 +43,8 @@ module Elasticsearch
43
43
  # @yieldparam document [Hash] yields a document found in the search hits.
44
44
  #
45
45
  def each(&block)
46
- @docs = []
47
- @scroll_id = nil
48
- refresh_docs
49
- for doc in @docs do
50
- refresh_docs
51
- yield doc
46
+ until (docs = results).empty?
47
+ docs.each(&block)
52
48
  end
53
49
  clear
54
50
  end
@@ -70,17 +66,11 @@ module Elasticsearch
70
66
  #
71
67
  def clear
72
68
  @client.clear_scroll(body: { scroll_id: @scroll_id }) if @scroll_id
73
- @docs = []
69
+ @scroll_id = nil
74
70
  end
75
71
 
76
72
  private
77
73
 
78
- def refresh_docs
79
- @docs ||= []
80
- @docs << results
81
- @docs.flatten!
82
- end
83
-
84
74
  def initial_search
85
75
  response = @client.search(index: @index, scroll: @scroll, body: @body)
86
76
  @scroll_id = response['_scroll_id']
@@ -88,7 +78,7 @@ module Elasticsearch
88
78
  end
89
79
 
90
80
  def scroll_request
91
- @client.scroll(body: {scroll: @scroll, scroll_id: @scroll_id})['hits']['hits']
81
+ @client.scroll(body: { scroll: @scroll, scroll_id: @scroll_id })['hits']['hits']
92
82
  end
93
83
  end
94
84
  end
@@ -16,5 +16,5 @@
16
16
  # under the License.
17
17
 
18
18
  module Elasticsearch
19
- VERSION = '8.17.0'.freeze
19
+ VERSION = '8.17.1'.freeze
20
20
  end
@@ -18,64 +18,66 @@ require_relative 'helpers_spec_helper'
18
18
  require 'elasticsearch/helpers/scroll_helper'
19
19
 
20
20
  context 'Elasticsearch client helpers' do
21
- let(:index) { 'books' }
22
- let(:body) { { size: 12, query: { match_all: {} } } }
23
- let(:scroll_helper) { Elasticsearch::Helpers::ScrollHelper.new(client, index, body) }
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) }
24
25
 
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
54
-
55
- after do
56
- client.indices.delete(index: index)
57
- end
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
58
55
 
59
- it 'instantiates a scroll helper' do
60
- expect(scroll_helper).to be_an_instance_of Elasticsearch::Helpers::ScrollHelper
61
- end
56
+ after do
57
+ client.indices.delete(index: index)
58
+ end
62
59
 
63
- it 'searches an index' do
64
- my_documents = []
65
- while !(documents = scroll_helper.results).empty?
66
- my_documents << documents
60
+ it 'instantiates a scroll helper' do
61
+ expect(scroll_helper).to be_an_instance_of Elasticsearch::Helpers::ScrollHelper
67
62
  end
68
63
 
69
- expect(my_documents.flatten.size).to eq 24
70
- end
64
+ it 'searches an index' do
65
+ my_documents = []
66
+ while !(documents = scroll_helper.results).empty?
67
+ my_documents << documents
68
+ end
71
69
 
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
70
+ expect(my_documents.flatten.size).to eq 24
71
+ end
72
+
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
80
82
  end
81
83
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.17.0
4
+ version: 8.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-11 00:00:00.000000000 Z
10
+ date: 2025-01-15 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: elastic-transport
@@ -30,14 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - '='
32
31
  - !ruby/object:Gem::Version
33
- version: 8.17.0
32
+ version: 8.17.1
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - '='
39
38
  - !ruby/object:Gem::Version
40
- version: 8.17.0
39
+ version: 8.17.1
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: base64
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -241,7 +240,6 @@ metadata:
241
240
  changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/main/CHANGELOG.md
242
241
  source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/main
243
242
  bug_tracker_uri: https://github.com/elastic/elasticsearch-ruby/issues
244
- post_install_message:
245
243
  rdoc_options:
246
244
  - "--charset=UTF-8"
247
245
  require_paths:
@@ -257,8 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
255
  - !ruby/object:Gem::Version
258
256
  version: '0'
259
257
  requirements: []
260
- rubygems_version: 3.5.20
261
- signing_key:
258
+ rubygems_version: 3.6.2
262
259
  specification_version: 4
263
260
  summary: Ruby integrations for Elasticsearch
264
261
  test_files: