elasticsearch 8.16.0 → 8.16.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1da188911e7b9929a793a87d64a8ea71affd01bcf0bbaa95ee327488f36b383
|
4
|
+
data.tar.gz: dc779e3f3881c4a1a1fcdbbdaf657eaaf423a3139f4eeafd62f355616357e3ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d7d77a602139442943b1014687038a9f17e85cccb336dba71cb20eb4f5ba85eb1d21f078069186f08a00723d948626a47a886be2be3eb84b9158b3305e5ee1d
|
7
|
+
data.tar.gz: ae8ec37c36fdec935169f49389cde45066ec8b09b36b3981961dd33e5cd3c7f2b530dd68bb3cd5b94171426c53672139be54fe1861afc4a94e469095f59711e1
|
data/elasticsearch.gemspec
CHANGED
@@ -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.
|
49
|
+
s.add_dependency 'elasticsearch-api', '8.16.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
|
-
|
47
|
-
|
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
|
-
@
|
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
|
@@ -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
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
56
|
+
after do
|
57
|
+
client.indices.delete(index: index)
|
58
|
+
end
|
62
59
|
|
63
|
-
|
64
|
-
|
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
|
-
|
70
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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.16.
|
4
|
+
version: 8.16.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:
|
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.16.
|
32
|
+
version: 8.16.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.16.
|
39
|
+
version: 8.16.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.
|
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:
|