zelastic 0.7.0 → 0.9.0
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/.github/workflows/ci.yml +45 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +41 -9
- data/CODEOWNERS +5 -0
- data/README.md +45 -3
- data/lib/zelastic/config.rb +13 -12
- data/lib/zelastic/index_manager.rb +42 -11
- data/lib/zelastic/indexer.rb +10 -22
- data/lib/zelastic/version.rb +1 -1
- data/log/.keep +0 -0
- data/zelastic.gemspec +4 -3
- metadata +30 -31
- data/.circleci/config.yml +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be9663f3819fc9057a838604106173e90e8b48219542a67eeac5f6493e696921
|
|
4
|
+
data.tar.gz: 67c3775b7911527728fc417c1978e223155d73bb7ade42629d8c595f2fcb0193
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 668853db1e94c690e8a86c32b1de997d11563d531cdef95b8f9dcab49df74ac412e36d2b79832ff12bcd82a8dc7740ca0afaa76acf82af2a83efb12e2d55f15d
|
|
7
|
+
data.tar.gz: e2e6f75c50b0c763654136fdf753e0734c0d79f5112f467c5f4fa6142cb332272595eecf1061120e82110bfd18ae08e0215fe205090cf35c23ea03b461fe6b98
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: ES ${{ matrix.elasticsearch }} / Gem ${{ matrix.elasticsearch_gem }}
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
elasticsearch: ["8.3.3"]
|
|
18
|
+
elasticsearch_gem: ["~> 8", "~> 7"]
|
|
19
|
+
include:
|
|
20
|
+
- elasticsearch: "7.17.5"
|
|
21
|
+
elasticsearch_gem: "~> 7"
|
|
22
|
+
|
|
23
|
+
services:
|
|
24
|
+
elasticsearch:
|
|
25
|
+
image: elasticsearch:${{ matrix.elasticsearch }}
|
|
26
|
+
env:
|
|
27
|
+
discovery.type: single-node
|
|
28
|
+
xpack.security.enabled: "false"
|
|
29
|
+
ports:
|
|
30
|
+
- 9200:9200
|
|
31
|
+
options: --health-cmd "curl -s http://localhost:9200" --health-interval 5s --health-timeout 3s --health-retries 20
|
|
32
|
+
|
|
33
|
+
env:
|
|
34
|
+
ELASTICSEARCH_GEM_VERSION: ${{ matrix.elasticsearch_gem }}
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
|
|
39
|
+
- uses: ruby/setup-ruby@v1
|
|
40
|
+
with:
|
|
41
|
+
ruby-version: "3.4"
|
|
42
|
+
bundler-cache: true
|
|
43
|
+
|
|
44
|
+
- run: bin/rubocop
|
|
45
|
+
- run: bin/rspec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
---
|
|
1
|
+
# Changelog
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
The format is based on [Keep a Changelog],
|
|
6
|
+
and this project adheres to [Semantic Versioning].
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
|
|
9
|
+
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
|
|
10
10
|
|
|
11
|
+
## How do I make a good changelog?
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
---
|
|
13
|
+
### Guiding Principles
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- Changelogs are for humans, not machines.
|
|
16
|
+
- There should be an entry for every single version.
|
|
17
|
+
- The same types of changes should be grouped.
|
|
18
|
+
- Versions and sections should be linkable.
|
|
19
|
+
- The latest version comes first.
|
|
20
|
+
- The release date of each version is displayed.
|
|
21
|
+
- Keep an `Unreleased` section at the top to track upcoming changes.
|
|
22
|
+
|
|
23
|
+
### Types of changes
|
|
24
|
+
|
|
25
|
+
- `Added` for new features.
|
|
26
|
+
- `Changed` for changes in existing functionality.
|
|
27
|
+
- `Deprecated` for soon-to-be removed features.
|
|
28
|
+
- `Removed` for now removed features.
|
|
29
|
+
- `Fixed` for any bug fixes.
|
|
30
|
+
- `Security` in case of vulnerabilities.
|
|
31
|
+
|
|
32
|
+
## [Unreleased] - XXXX-XX-XX
|
|
33
|
+
|
|
34
|
+
## [0.8.0] - 2022-08-19
|
|
35
|
+
### Added
|
|
36
|
+
- Support for Ruby 3 (and keep support for 2.7).
|
|
37
|
+
- Support for Elasticsearch v8 (and keep support for v7).
|
|
38
|
+
- Support setting a logger in `Config`.
|
|
39
|
+
- Support refresh on `IndexManager#populate_index`.
|
|
40
|
+
- Support Proc in `Config#data_source` so it can be lazily evaluated.
|
|
41
|
+
|
|
42
|
+
### Removed
|
|
43
|
+
- Drop support for Ruby 2.6.
|
|
44
|
+
- Drop support for Elasticsearch v5 and v6.
|
|
45
|
+
|
|
46
|
+
[Unreleased]: https://github.com/carwow/zelastic/compare/v0.8.0...HEAD
|
|
47
|
+
[0.8.0]: https://github.com/carwow/zelastic/releases/tag/v0.8.0
|
data/CODEOWNERS
ADDED
data/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Zelastic
|
|
2
|
+
|
|
3
|
+
Zero-downtime Elasticsearch tooling for managing indices and indexing from
|
|
4
|
+
ActiveRecord with PostgreSQL to Elasticsearch.
|
|
2
5
|
|
|
3
6
|
## Installation
|
|
4
7
|
|
|
@@ -10,13 +13,14 @@ gem 'zelastic'
|
|
|
10
13
|
|
|
11
14
|
And then execute:
|
|
12
15
|
|
|
13
|
-
$ bundle
|
|
16
|
+
$ bundle install
|
|
14
17
|
|
|
15
18
|
Or install it yourself as:
|
|
16
19
|
|
|
17
20
|
$ gem install zelastic
|
|
18
21
|
|
|
19
22
|
## Usage
|
|
23
|
+
|
|
20
24
|
### Setup
|
|
21
25
|
|
|
22
26
|
For each ActiveRecord scope you want to index, you'll need a configuration:
|
|
@@ -46,7 +50,6 @@ You can also override some defaults, if you wish:
|
|
|
46
50
|
here
|
|
47
51
|
- `read_alias`: by default this is the table name of the `data_source`
|
|
48
52
|
- `write_alias`: by default this is the `read_alias`, with `_write` appended
|
|
49
|
-
- `type`: by default this is `read_alias.singularize`
|
|
50
53
|
|
|
51
54
|
If you pass an array to as the `client` argument, all writes will be applied to every client in the
|
|
52
55
|
array.
|
|
@@ -99,6 +102,45 @@ The `client` keyword argument to `Zelastic::IndexManager.new` is optional. It de
|
|
|
99
102
|
passed to `Zelastic::Config.new`, if one client is passed, or the first client in the array, if an
|
|
100
103
|
array is passed to `Zelastic::Config.new`.
|
|
101
104
|
|
|
105
|
+
### Reindexing using Elasticsearch's Reindex API
|
|
106
|
+
|
|
107
|
+
For large indices, you can use Elasticsearch's native reindex API instead of `populate_index`:
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
index_manager = Zelastic::IndexManager.new(MyModelIndex)
|
|
111
|
+
source_index = index_manager.current_read_index
|
|
112
|
+
dest_index = index_manager.current_write_index # or any target index name
|
|
113
|
+
index_manager.reindex(source_index: source_index, dest_index: dest_index)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Reindexing from a remote Elasticsearch instance
|
|
117
|
+
|
|
118
|
+
If you have multiple Elasticsearch instances (e.g., primary and secondary), you can copy data
|
|
119
|
+
from one to another using the `reindex_from_remote` method:
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
# On the destination ES instance
|
|
123
|
+
secondary_client = Elasticsearch::Client.new(url: ENV['SECONDARY_ELASTICSEARCH_URL'])
|
|
124
|
+
index_manager = Zelastic::IndexManager.new(MyModelIndex, client: secondary_client)
|
|
125
|
+
|
|
126
|
+
# Get the source index name from the primary instance
|
|
127
|
+
primary_client = Elasticsearch::Client.new(url: ENV['ELASTICSEARCH_URL'])
|
|
128
|
+
source_index = primary_client.indices.get_alias(name: MyModelIndex.read_alias).keys.first
|
|
129
|
+
|
|
130
|
+
dest_index = index_manager.current_write_index
|
|
131
|
+
index_manager.reindex_from_remote(
|
|
132
|
+
source_host: ENV['ELASTICSEARCH_URL'],
|
|
133
|
+
source_index: source_index,
|
|
134
|
+
dest_index: dest_index,
|
|
135
|
+
username: ENV['ELASTICSEARCH_USERNAME'], # optional
|
|
136
|
+
password: ENV['ELASTICSEARCH_PASSWORD'], # optional
|
|
137
|
+
wait_for_completion: false # runs asynchronously by default
|
|
138
|
+
)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Note: For remote reindexing to work, the destination Elasticsearch cluster must have the source
|
|
142
|
+
host configured in `reindex.remote.whitelist` in `elasticsearch.yml`.
|
|
143
|
+
|
|
102
144
|
## Development
|
|
103
145
|
|
|
104
146
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/zelastic/config.rb
CHANGED
|
@@ -2,31 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
module Zelastic
|
|
4
4
|
class Config
|
|
5
|
-
attr_reader :clients
|
|
5
|
+
attr_reader :clients
|
|
6
6
|
|
|
7
7
|
def initialize(
|
|
8
8
|
client:,
|
|
9
9
|
data_source:,
|
|
10
10
|
mapping:,
|
|
11
|
+
logger: nil,
|
|
11
12
|
**overrides,
|
|
12
13
|
&index_data
|
|
13
14
|
)
|
|
14
15
|
@clients = Array(client)
|
|
15
16
|
@data_source = data_source
|
|
16
17
|
@mapping = mapping
|
|
17
|
-
@
|
|
18
|
-
@_type = overrides.fetch(:type, true)
|
|
18
|
+
@logger = logger
|
|
19
19
|
@overrides = overrides
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def type?
|
|
23
|
-
@_type
|
|
20
|
+
@index_data = index_data
|
|
24
21
|
end
|
|
25
22
|
|
|
26
23
|
def index_data(model)
|
|
27
24
|
@index_data.call(model)
|
|
28
25
|
end
|
|
29
26
|
|
|
27
|
+
def data_source
|
|
28
|
+
if @data_source.respond_to? :call
|
|
29
|
+
@data_source.call
|
|
30
|
+
else
|
|
31
|
+
@data_source
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
30
35
|
def read_alias
|
|
31
36
|
@read_alias ||= overrides.fetch(:read_alias) { data_source.table_name }
|
|
32
37
|
end
|
|
@@ -35,10 +40,6 @@ module Zelastic
|
|
|
35
40
|
@write_alias ||= overrides.fetch(:write_alias) { [read_alias, 'write'].join('_') }
|
|
36
41
|
end
|
|
37
42
|
|
|
38
|
-
def type
|
|
39
|
-
@type ||= overrides.fetch(:type, read_alias.singularize)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
43
|
def logger
|
|
43
44
|
return Rails.logger if defined?(Rails)
|
|
44
45
|
|
|
@@ -48,7 +49,7 @@ module Zelastic
|
|
|
48
49
|
def index_definition
|
|
49
50
|
{
|
|
50
51
|
settings: overrides.fetch(:index_settings, {}),
|
|
51
|
-
mappings:
|
|
52
|
+
mappings: mapping
|
|
52
53
|
}
|
|
53
54
|
end
|
|
54
55
|
|
|
@@ -16,12 +16,12 @@ module Zelastic
|
|
|
16
16
|
client.indices.put_alias(index: index_name, name: config.write_alias)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def populate_index(unique_name = nil, batch_size: 3000)
|
|
19
|
+
def populate_index(unique_name = nil, batch_size: 3000, refresh: false)
|
|
20
20
|
index_name = index_name_from_unique(unique_name)
|
|
21
21
|
|
|
22
22
|
config.data_source.find_in_batches(batch_size: batch_size).with_index do |batch, i|
|
|
23
23
|
logger.info(populate_index_log(batch_size: batch_size, batch_number: i + 1))
|
|
24
|
-
indexer.index_batch(batch, client: client, index_name: index_name)
|
|
24
|
+
indexer.index_batch(batch, client: client, index_name: index_name, refresh: refresh)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -92,12 +92,50 @@ module Zelastic
|
|
|
92
92
|
client.indices.delete(index: indices_to_delete)
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
+
def reindex_from_local(source_index:, dest_index:, wait_for_completion: false)
|
|
96
|
+
logger.info("Reindexing from #{source_index} to #{dest_index}")
|
|
97
|
+
reindex(source: { index: source_index }, dest_index: dest_index,
|
|
98
|
+
wait_for_completion: wait_for_completion
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def reindex_from_remote(source_host:, source_index:, dest_index:,
|
|
103
|
+
username: nil, password: nil, wait_for_completion: false)
|
|
104
|
+
logger.info("Reindexing from remote #{source_host}/#{source_index} to #{dest_index}")
|
|
105
|
+
|
|
106
|
+
remote = { host: source_host }
|
|
107
|
+
remote[:username] = username if username
|
|
108
|
+
remote[:password] = password if password
|
|
109
|
+
|
|
110
|
+
reindex(source: { remote: remote, index: source_index }, dest_index: dest_index,
|
|
111
|
+
wait_for_completion: wait_for_completion
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def current_read_index
|
|
116
|
+
client.indices.get_alias(name: config.read_alias).keys.first
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def current_write_index
|
|
120
|
+
client.indices.get_alias(name: config.write_alias).keys.first
|
|
121
|
+
end
|
|
122
|
+
|
|
95
123
|
private
|
|
96
124
|
|
|
97
125
|
attr_reader :config, :client
|
|
98
126
|
|
|
99
127
|
def_delegators :config, :logger
|
|
100
128
|
|
|
129
|
+
def reindex(source:, dest_index:, wait_for_completion:)
|
|
130
|
+
client.reindex(
|
|
131
|
+
body: {
|
|
132
|
+
source: source,
|
|
133
|
+
dest: { index: dest_index }
|
|
134
|
+
},
|
|
135
|
+
wait_for_completion: wait_for_completion
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
101
139
|
def indexer
|
|
102
140
|
@indexer ||= Indexer.new(config)
|
|
103
141
|
end
|
|
@@ -116,18 +154,11 @@ module Zelastic
|
|
|
116
154
|
else
|
|
117
155
|
'First index'
|
|
118
156
|
end
|
|
119
|
-
"ES: (#{progress}) Indexing
|
|
157
|
+
"ES: (#{progress}) Indexing records"
|
|
120
158
|
end
|
|
121
159
|
|
|
122
160
|
def current_index_size
|
|
123
|
-
@current_index_size ||= client.count(
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def count_params
|
|
127
|
-
{
|
|
128
|
-
index: config.read_alias,
|
|
129
|
-
type: config.type? ? config.type : nil
|
|
130
|
-
}.compact
|
|
161
|
+
@current_index_size ||= client.count(index: config.read_alias)['count']
|
|
131
162
|
end
|
|
132
163
|
|
|
133
164
|
def indexed_percent(batch_size, batch_number)
|
data/lib/zelastic/indexer.rb
CHANGED
|
@@ -13,6 +13,10 @@ module Zelastic
|
|
|
13
13
|
|
|
14
14
|
extend Forwardable
|
|
15
15
|
|
|
16
|
+
VERSION_CONFLICT_ERROR_REGEXP =
|
|
17
|
+
/^\[\d+\]: version conflict, current version \[\d+\] is higher or equal to the one provided \[\d+\]$/
|
|
18
|
+
private_constant :VERSION_CONFLICT_ERROR_REGEXP
|
|
19
|
+
|
|
16
20
|
def initialize(config)
|
|
17
21
|
@config = config
|
|
18
22
|
end
|
|
@@ -43,10 +47,7 @@ module Zelastic
|
|
|
43
47
|
|
|
44
48
|
execute_bulk do |index_name|
|
|
45
49
|
ids.map do |id|
|
|
46
|
-
|
|
47
|
-
delete_params[:_type] = config.type if config.type?
|
|
48
|
-
|
|
49
|
-
{ delete: delete_params }
|
|
50
|
+
{ delete: { _index: index_name, _id: id } }
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
end
|
|
@@ -76,19 +77,14 @@ module Zelastic
|
|
|
76
77
|
end
|
|
77
78
|
|
|
78
79
|
def index_command(index:, version:, record:)
|
|
79
|
-
version_params =
|
|
80
|
-
if config.type?
|
|
81
|
-
{ _version: version, _version_type: :external, _type: config.type }
|
|
82
|
-
else
|
|
83
|
-
{ version: version, version_type: :external }
|
|
84
|
-
end
|
|
85
|
-
|
|
86
80
|
{
|
|
87
81
|
index: {
|
|
88
82
|
_index: index,
|
|
89
83
|
_id: record.id,
|
|
90
|
-
data: config.index_data(record)
|
|
91
|
-
|
|
84
|
+
data: config.index_data(record),
|
|
85
|
+
version: version,
|
|
86
|
+
version_type: :external
|
|
87
|
+
}
|
|
92
88
|
}
|
|
93
89
|
end
|
|
94
90
|
|
|
@@ -123,16 +119,8 @@ module Zelastic
|
|
|
123
119
|
end
|
|
124
120
|
|
|
125
121
|
def ignorable_error?(error)
|
|
126
|
-
# rubocop:disable Layout/LineLength
|
|
127
|
-
regexp =
|
|
128
|
-
if config.type?
|
|
129
|
-
/^\[#{config.type}\]\[\d+\]: version conflict, current version \[\d+\] is higher or equal to the one provided \[\d+\]$/
|
|
130
|
-
else
|
|
131
|
-
/^\[\d+\]: version conflict, current version \[\d+\] is higher or equal to the one provided \[\d+\]$/
|
|
132
|
-
end
|
|
133
|
-
# rubocop:enable Layout/LineLength
|
|
134
122
|
error['type'] == 'version_conflict_engine_exception' &&
|
|
135
|
-
error['reason'] =~
|
|
123
|
+
error['reason'] =~ VERSION_CONFLICT_ERROR_REGEXP
|
|
136
124
|
end
|
|
137
125
|
end
|
|
138
126
|
end
|
data/lib/zelastic/version.rb
CHANGED
data/log/.keep
ADDED
|
File without changes
|
data/zelastic.gemspec
CHANGED
|
@@ -22,12 +22,13 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
23
|
spec.require_paths = ['lib']
|
|
24
24
|
|
|
25
|
+
spec.add_dependency 'elasticsearch', '>= 7', '< 9'
|
|
26
|
+
|
|
27
|
+
spec.add_dependency 'activerecord'
|
|
25
28
|
spec.add_dependency 'activesupport'
|
|
26
29
|
|
|
27
|
-
spec.add_development_dependency 'activerecord'
|
|
28
30
|
spec.add_development_dependency 'bundler', '~> 2'
|
|
29
|
-
spec.add_development_dependency 'carwow_rubocop', '~>
|
|
30
|
-
spec.add_development_dependency 'elasticsearch', '>= 5', '< 8'
|
|
31
|
+
spec.add_development_dependency 'carwow_rubocop', '~> 6'
|
|
31
32
|
spec.add_development_dependency 'pry', '~> 0.14'
|
|
32
33
|
spec.add_development_dependency 'rake', '~> 13'
|
|
33
34
|
spec.add_development_dependency 'rspec', '~> 3'
|
metadata
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zelastic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- carwow Developers
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: elasticsearch
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '7'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '9'
|
|
20
22
|
type: :runtime
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
25
|
requirements:
|
|
24
26
|
- - ">="
|
|
25
27
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
28
|
+
version: '7'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '9'
|
|
27
32
|
- !ruby/object:Gem::Dependency
|
|
28
33
|
name: activerecord
|
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -31,7 +36,7 @@ dependencies:
|
|
|
31
36
|
- - ">="
|
|
32
37
|
- !ruby/object:Gem::Version
|
|
33
38
|
version: '0'
|
|
34
|
-
type: :
|
|
39
|
+
type: :runtime
|
|
35
40
|
prerelease: false
|
|
36
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
42
|
requirements:
|
|
@@ -39,53 +44,47 @@ dependencies:
|
|
|
39
44
|
- !ruby/object:Gem::Version
|
|
40
45
|
version: '0'
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
47
|
+
name: activesupport
|
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
|
44
49
|
requirements:
|
|
45
|
-
- - "
|
|
50
|
+
- - ">="
|
|
46
51
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
48
|
-
type: :
|
|
52
|
+
version: '0'
|
|
53
|
+
type: :runtime
|
|
49
54
|
prerelease: false
|
|
50
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
56
|
requirements:
|
|
52
|
-
- - "
|
|
57
|
+
- - ">="
|
|
53
58
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
59
|
+
version: '0'
|
|
55
60
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
61
|
+
name: bundler
|
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
|
58
63
|
requirements:
|
|
59
64
|
- - "~>"
|
|
60
65
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
66
|
+
version: '2'
|
|
62
67
|
type: :development
|
|
63
68
|
prerelease: false
|
|
64
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
70
|
requirements:
|
|
66
71
|
- - "~>"
|
|
67
72
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
73
|
+
version: '2'
|
|
69
74
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
75
|
+
name: carwow_rubocop
|
|
71
76
|
requirement: !ruby/object:Gem::Requirement
|
|
72
77
|
requirements:
|
|
73
|
-
- - "
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '5'
|
|
76
|
-
- - "<"
|
|
78
|
+
- - "~>"
|
|
77
79
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: '
|
|
80
|
+
version: '6'
|
|
79
81
|
type: :development
|
|
80
82
|
prerelease: false
|
|
81
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
84
|
requirements:
|
|
83
|
-
- - "
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: '5'
|
|
86
|
-
- - "<"
|
|
85
|
+
- - "~>"
|
|
87
86
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
87
|
+
version: '6'
|
|
89
88
|
- !ruby/object:Gem::Dependency
|
|
90
89
|
name: pry
|
|
91
90
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -135,12 +134,13 @@ executables: []
|
|
|
135
134
|
extensions: []
|
|
136
135
|
extra_rdoc_files: []
|
|
137
136
|
files:
|
|
138
|
-
- ".circleci/config.yml"
|
|
139
137
|
- ".github/dependabot.yml"
|
|
138
|
+
- ".github/workflows/ci.yml"
|
|
140
139
|
- ".gitignore"
|
|
141
140
|
- ".rspec"
|
|
142
141
|
- ".rubocop.yml"
|
|
143
142
|
- CHANGELOG.md
|
|
143
|
+
- CODEOWNERS
|
|
144
144
|
- Gemfile
|
|
145
145
|
- LICENSE.txt
|
|
146
146
|
- README.md
|
|
@@ -154,12 +154,12 @@ files:
|
|
|
154
154
|
- lib/zelastic/index_manager.rb
|
|
155
155
|
- lib/zelastic/indexer.rb
|
|
156
156
|
- lib/zelastic/version.rb
|
|
157
|
+
- log/.keep
|
|
157
158
|
- zelastic.gemspec
|
|
158
159
|
homepage: https://github.com/carwow/zelastic
|
|
159
160
|
licenses:
|
|
160
161
|
- MIT
|
|
161
162
|
metadata: {}
|
|
162
|
-
post_install_message:
|
|
163
163
|
rdoc_options: []
|
|
164
164
|
require_paths:
|
|
165
165
|
- lib
|
|
@@ -174,8 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
174
174
|
- !ruby/object:Gem::Version
|
|
175
175
|
version: '0'
|
|
176
176
|
requirements: []
|
|
177
|
-
rubygems_version:
|
|
178
|
-
signing_key:
|
|
177
|
+
rubygems_version: 4.0.3
|
|
179
178
|
specification_version: 4
|
|
180
179
|
summary: Zero-downtime (re-)indexing of ActiveRecord models into Elasticsearch.
|
|
181
180
|
test_files: []
|
data/.circleci/config.yml
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
jobs:
|
|
4
|
-
test:
|
|
5
|
-
parameters:
|
|
6
|
-
ruby_version:
|
|
7
|
-
type: string
|
|
8
|
-
elasticsearch_version:
|
|
9
|
-
type: string
|
|
10
|
-
elasticsearch_gem_version:
|
|
11
|
-
type: string
|
|
12
|
-
docker:
|
|
13
|
-
- image: "cimg/ruby:<< parameters.ruby_version >>"
|
|
14
|
-
- image: "elasticsearch:<< parameters.elasticsearch_version >>"
|
|
15
|
-
environment:
|
|
16
|
-
"discovery.type": single-node
|
|
17
|
-
environment:
|
|
18
|
-
ELASTICSEARCH_GEM_VERSION: "<< parameters.elasticsearch_gem_version >>"
|
|
19
|
-
steps:
|
|
20
|
-
- checkout
|
|
21
|
-
- run: bin/setup
|
|
22
|
-
- run: bin/rubocop
|
|
23
|
-
- run: dockerize -wait http://localhost:9200 -timeout 1m
|
|
24
|
-
- run: bin/rspec
|
|
25
|
-
|
|
26
|
-
workflows:
|
|
27
|
-
version: 2
|
|
28
|
-
test:
|
|
29
|
-
jobs:
|
|
30
|
-
- test:
|
|
31
|
-
name: "test with elasticsearch v7
|
|
32
|
-
and gem << matrix.elasticsearch_gem_version >>
|
|
33
|
-
and ruby v<< matrix.ruby_version >>"
|
|
34
|
-
elasticsearch_version: "7.17.5"
|
|
35
|
-
matrix:
|
|
36
|
-
parameters:
|
|
37
|
-
ruby_version: ["3.1", "2.7"]
|
|
38
|
-
elasticsearch_gem_version: ["~> 7", "~> 5"]
|
|
39
|
-
- test:
|
|
40
|
-
name: "test with elasticsearch v5
|
|
41
|
-
and gem ~> 5
|
|
42
|
-
and ruby v<< matrix.ruby_version >>"
|
|
43
|
-
elasticsearch_version: "5.6-alpine"
|
|
44
|
-
elasticsearch_gem_version: "~> 5"
|
|
45
|
-
matrix:
|
|
46
|
-
parameters:
|
|
47
|
-
ruby_version: ["3.1", "2.7"]
|