co-elastic-query 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/co-elastic-query.rb +18 -3
- data/lib/co-elastic-query/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44620f7cdbc28d841c1402225963cbbc6cbb61f6dbb6393f3a93a550cab082a8
|
4
|
+
data.tar.gz: 66be8e623e933373bc44e733719e170139d030c30635b174a0643a51a7071c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efd8d0e2300a5cede790968cb36f671429140f29e931d5364e866b7516e7f818fe3fc675482316444e5ecfc508a897879ead9599574423716bf5b16fdf2151a8
|
7
|
+
data.tar.gz: 79d9af5706b03bf4a2df3c5ecaa3d2bc8c72148c89d332729ea60f586c8c902cbbb7dca08ce9d87b794462b5c52742486b617a52e897f98097e87f2f0f5cb974
|
data/lib/co-elastic-query.rb
CHANGED
@@ -308,6 +308,10 @@ class Elastic
|
|
308
308
|
@@client
|
309
309
|
end
|
310
310
|
|
311
|
+
def self.new_client
|
312
|
+
@@client = Elasticsearch::Client.new hosts: HOST, reload_connections: true, adapter: :libuv
|
313
|
+
end
|
314
|
+
|
311
315
|
COUNT = 'count'.freeze
|
312
316
|
HITS = 'hits'.freeze
|
313
317
|
TOTAL = 'total'.freeze
|
@@ -360,7 +364,7 @@ class Elastic
|
|
360
364
|
results: results
|
361
365
|
}
|
362
366
|
end
|
363
|
-
|
367
|
+
|
364
368
|
def count(builder)
|
365
369
|
query = generate_body(builder)
|
366
370
|
|
@@ -371,8 +375,8 @@ class Elastic
|
|
371
375
|
|
372
376
|
Elastic.count(query)[COUNT]
|
373
377
|
end
|
374
|
-
|
375
|
-
|
378
|
+
|
379
|
+
|
376
380
|
def generate_body(builder)
|
377
381
|
opt = builder.build
|
378
382
|
|
@@ -417,3 +421,14 @@ class Elastic
|
|
417
421
|
}
|
418
422
|
end
|
419
423
|
end
|
424
|
+
|
425
|
+
Thread.new do
|
426
|
+
loop do
|
427
|
+
sleep 600
|
428
|
+
begin
|
429
|
+
Elastic.new_client
|
430
|
+
rescue => e
|
431
|
+
puts "failed to create new elastic client: #{e.message}"
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: co-elastic-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
- Will Cannings
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '2.0'
|
70
|
-
description:
|
70
|
+
description:
|
71
71
|
email:
|
72
72
|
- steve@cotag.me
|
73
73
|
- me@willcannings.com
|
@@ -87,7 +87,7 @@ homepage: http://cotag.me/
|
|
87
87
|
licenses:
|
88
88
|
- MIT
|
89
89
|
metadata: {}
|
90
|
-
post_install_message:
|
90
|
+
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
@@ -102,9 +102,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubyforge_project:
|
105
|
+
rubyforge_project:
|
106
106
|
rubygems_version: 2.7.7
|
107
|
-
signing_key:
|
107
|
+
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Elasticsearch query generator
|
110
110
|
test_files: []
|