elasticsearch_hermes 0.0.4 → 0.0.4.1
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 +4 -4
- data/lib/elasticsearch_hermes/configuration.rb +6 -6
- data/lib/elasticsearch_hermes/elasticsearch_hermes.rb +45 -0
- data/lib/elasticsearch_hermes/errors.rb +6 -0
- data/lib/elasticsearch_hermes/hook.rb +9 -0
- data/lib/elasticsearch_hermes/index.rb +1 -1
- data/lib/elasticsearch_hermes/logger.rb +7 -0
- data/lib/elasticsearch_hermes/railtie.rb +10 -0
- data/lib/elasticsearch_hermes/version.rb +1 -1
- data/lib/elasticsearch_hermes.rb +6 -35
- metadata +29 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc9f73e651b45f5a8e692dfc08bb441048290141
|
4
|
+
data.tar.gz: d8a917eedaa40d3297eda5e9bb177ccd3da6a558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82f7ddbc439c4813ce7e9af65d914fc1c4f9244c00b8d7f3d2294547b008f620c4e2cd05a25ab8815bb6a26312444cc37d419e5e483b13071929d243e9a4a205
|
7
|
+
data.tar.gz: c0f4670d78afeafac6eb034c595d2049ce2720be5bcaab904c4d6d73d692438a684017b3c0dac648a29fda674f0e84ade8b650a244de34f200289484dd094310
|
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
module ElasticsearchHermes
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :request_timeout, :retry_on_failure, :
|
6
|
-
|
5
|
+
attr_accessor :request_timeout, :retry_on_failure, :es_user, :es_password
|
6
|
+
attr_accessor :es_url, :enable_logs
|
7
7
|
def initialize
|
8
8
|
@request_timeout = nil
|
9
9
|
@retry_on_failure = nil
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@
|
10
|
+
@es_user = nil
|
11
|
+
@es_password = nil
|
12
|
+
@es_url = nil
|
13
|
+
@enable_logs = nil
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'elasticsearch'
|
4
|
+
|
5
|
+
module ElasticsearchHermes
|
6
|
+
class << self
|
7
|
+
attr_writer :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configuration
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.reset
|
15
|
+
@configuration = Configuration.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.setup
|
19
|
+
yield(configuration)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.default_connect_options
|
23
|
+
base_es_urls = configuration.es_url
|
24
|
+
urls = base_es_urls.split(',').compact.uniq
|
25
|
+
options = { url: urls, retry_on_failure: 2, log: true }
|
26
|
+
options
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.client
|
30
|
+
@client ||= ::Elasticsearch::Client.new(default_connect_options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.connect!
|
34
|
+
return unless client
|
35
|
+
|
36
|
+
info = @client.info
|
37
|
+
cluster_version = info['version']['number']
|
38
|
+
msg = "Connected to Elastic version #{cluster_version}."
|
39
|
+
Logger.log(msg)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.refresh
|
43
|
+
client.indices.refresh
|
44
|
+
end
|
45
|
+
end
|
data/lib/elasticsearch_hermes.rb
CHANGED
@@ -1,39 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'elasticsearch'
|
4
|
-
require 'elasticsearch_hermes/configuration'
|
5
3
|
require 'elasticsearch_hermes/version'
|
4
|
+
require 'elasticsearch_hermes/railtie'
|
5
|
+
require 'elasticsearch_hermes/errors'
|
6
|
+
require 'elasticsearch_hermes/configuration'
|
6
7
|
require 'elasticsearch_hermes/index'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
attr_writer :configuration
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.configuration
|
14
|
-
@configuration ||= Configuration.new
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.reset
|
18
|
-
@configuration = Configuration.new
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.configure
|
22
|
-
yield(configuration)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.default_connect_options
|
26
|
-
base_es_urls = configuration.elasticsearch_url
|
27
|
-
urls = base_es_urls.split(',').compact.uniq
|
28
|
-
options = { url: urls, retry_on_failure: 2, log: true }
|
29
|
-
options
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.client
|
33
|
-
@client ||= ::Elasticsearch::Client.new(default_connect_options)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.refresh
|
37
|
-
client.indices.refresh
|
38
|
-
end
|
39
|
-
end
|
8
|
+
require 'elasticsearch_hermes/hook'
|
9
|
+
require 'elasticsearch_hermes/logger'
|
10
|
+
require 'elasticsearch_hermes/elasticsearch_hermes'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch_hermes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4
|
4
|
+
version: 0.0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronald Ekambi
|
@@ -9,7 +9,27 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-12-01 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: elasticsearch
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 7.4.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '7.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 7.4.0
|
13
33
|
description:
|
14
34
|
email: ronekambi@gmail.com
|
15
35
|
executables: []
|
@@ -18,7 +38,12 @@ extra_rdoc_files: []
|
|
18
38
|
files:
|
19
39
|
- lib/elasticsearch_hermes.rb
|
20
40
|
- lib/elasticsearch_hermes/configuration.rb
|
41
|
+
- lib/elasticsearch_hermes/elasticsearch_hermes.rb
|
42
|
+
- lib/elasticsearch_hermes/errors.rb
|
43
|
+
- lib/elasticsearch_hermes/hook.rb
|
21
44
|
- lib/elasticsearch_hermes/index.rb
|
45
|
+
- lib/elasticsearch_hermes/logger.rb
|
46
|
+
- lib/elasticsearch_hermes/railtie.rb
|
22
47
|
- lib/elasticsearch_hermes/version.rb
|
23
48
|
homepage: https://github.com/roncodingenthusiast/elasticsearch_hermes
|
24
49
|
licenses:
|
@@ -43,5 +68,6 @@ rubyforge_project:
|
|
43
68
|
rubygems_version: 2.6.14.3
|
44
69
|
signing_key:
|
45
70
|
specification_version: 4
|
46
|
-
summary: elasticsearch_hermes is a layer on top of elasticsearch to handle
|
71
|
+
summary: elasticsearch_hermes is a layer on top of elasticsearch-ruby to handle the
|
72
|
+
complicated configuration of elastic
|
47
73
|
test_files: []
|