common_indexer 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/common_indexer/version.rb +1 -1
- data/lib/common_indexer.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c04288510a31222bf983bceb65b31f66e5d95d
|
4
|
+
data.tar.gz: cb7eafeef3b091eb6db73afdae1f0b90e9037852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41412f4df6230e21a54dbd3654c06662a14c760188fe65e2f1f7a5d519e150c271273dd075ca6b66022ab0f27387ffe762f0a667afc458776f6bb34d3163804c
|
7
|
+
data.tar.gz: 7d0c782d6c6a048a4daaf38c6bcbf68382d208275881c83747a2fa73a46d0a90a737522f704d6db472c061e839087952fda04e35a6207a5f81ab78858df9da05
|
data/README.md
CHANGED
@@ -40,6 +40,19 @@ Add an initializer to configure the CommonIndexer gem with the app settings:
|
|
40
40
|
end
|
41
41
|
```
|
42
42
|
|
43
|
+
You can pass in additional configuration if needed. Ex:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
CommonIndexer.configure_client do |f|
|
47
|
+
f.request :aws_sigv4,
|
48
|
+
service: service,
|
49
|
+
region: region,
|
50
|
+
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
51
|
+
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
52
|
+
session_token: ENV['AWS_SESSION_TOKEN'] # optional
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
43
56
|
## Usage
|
44
57
|
|
45
58
|
Include the CommonIndexer into your model that you want to index with `include ::CommonIndexer::Base`, and define a `#to_common_index` method in that model. `#to_common_index` should return a hash with metadata key/values that conform to the common index mapping.
|
data/lib/common_indexer.rb
CHANGED
@@ -25,6 +25,10 @@ module CommonIndexer # :nodoc:
|
|
25
25
|
@client ||= Elasticsearch::Client.new(hosts: config.endpoint)
|
26
26
|
end
|
27
27
|
|
28
|
+
def configure_client(&block)
|
29
|
+
@client = Elasticsearch::Client.new(hosts: config.endpoint, &block)
|
30
|
+
end
|
31
|
+
|
28
32
|
def configure_index!
|
29
33
|
new_index = [index_name, Time.now.utc.strftime('%Y%m%d%H%M%S%3N')].join('_')
|
30
34
|
client.indices.create(index: new_index)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: common_indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klein
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active-fedora
|