elastic_ar_sync 0.1.2 → 0.1.3
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/README.md +26 -4
- data/lib/elastic_ar_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a843a9b4af147022f7a825ebdf464db1db3eae84072e7a05c7b594690626c00c
|
4
|
+
data.tar.gz: 9832a3795e7af74850122c412391a55c5bbca261454385e5e1acc13262e484c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62095caeaeec0507d0f2357aa0d578be350938ed64afa1b24cf2d167cefe25b70c8a2759e37108ca5e41b32b9a8affd72f4ea0f26fc3fe9a356cba817c8d4902
|
7
|
+
data.tar.gz: ac74f2a041c26db4cfd1f76a26e3b86954c1d1fa75a3d1bd6228846fa87e1b267bc531ffe67b9875760cf16b7c23071abe9c3c5ef8c0d154a6eff2b9227755f0
|
data/README.md
CHANGED
@@ -9,11 +9,16 @@ Install `gem elasticsearch-rails`, `gem elasticsearch-model` and `gem elasticsea
|
|
9
9
|
|
10
10
|
Include module `ElasticArSync::Elastic::Syncable` on your Model class which is inherited ActiveRecord.
|
11
11
|
|
12
|
+
and define `index_config` after `include ElasticArSync::Elastic::Syncable` if you use this module normally.
|
13
|
+
|
14
|
+
you can override index_config described after.
|
15
|
+
|
12
16
|
example below
|
13
17
|
|
14
18
|
```ruby
|
15
19
|
class XXXXX < ActiveRecord
|
16
20
|
include ElasticArSync::Elastic::Syncable
|
21
|
+
index_config
|
17
22
|
end
|
18
23
|
```
|
19
24
|
|
@@ -24,6 +29,13 @@ update and delete is same as create.
|
|
24
29
|
|
25
30
|
this module contains class method `index_setup` to setup index.
|
26
31
|
|
32
|
+
setup means create new index and put alias to new index and sync whole records of RDB with new index,
|
33
|
+
then you can use new index without any command.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
XXXXX.index_setup
|
37
|
+
```
|
38
|
+
|
27
39
|
### usable methods
|
28
40
|
if your Model class included `ElasticArSync::Elastic::Syncable`, it can use class methods below.
|
29
41
|
|
@@ -66,17 +78,24 @@ you can use `index_config` after `include ElasticArSync::Elastic::Syncable`.
|
|
66
78
|
|
67
79
|
example below
|
68
80
|
|
69
|
-
you can override
|
81
|
+
you can override args `dynamic`, `number_of_shards`, `attr_mappings`.
|
70
82
|
especially default mapping is whole attributes of your Model class, so you can customize mapping attributes by overriding attr_mappings.
|
71
83
|
```ruby
|
72
84
|
index_config(dynamic: 'false', number_of_shards: 1, attr_mappings: { id: 'integer', name: 'text', birth: 'date' })
|
73
85
|
```
|
74
86
|
|
75
|
-
|
87
|
+
you can also override part of attributes by `override_mappings` like below
|
76
88
|
|
77
|
-
|
89
|
+
*As a premise, your model contain [id: integer, name: string, birth: date]
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
index_config(override_mappings: { birth: :keyword })
|
93
|
+
```
|
94
|
+
|
95
|
+
then birth will mapping as keyword type in index of elasticsearch.
|
96
|
+
|
97
|
+
if you define your original mapping additionally, you can define like below.
|
78
98
|
|
79
|
-
https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model
|
80
99
|
```ruby
|
81
100
|
settings index: { number_of_shards: number_of_shards } do
|
82
101
|
mappings do
|
@@ -85,6 +104,9 @@ https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model
|
|
85
104
|
end
|
86
105
|
```
|
87
106
|
|
107
|
+
tips: just reference here.
|
108
|
+
|
109
|
+
https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model
|
88
110
|
|
89
111
|
## Installation
|
90
112
|
Add this line to your application's Gemfile:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_ar_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KitakatsuTed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|