elastomer-client 6.2.1 → 6.2.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/.github/workflows/main.yml +3 -3
- data/CHANGELOG.md +7 -0
- data/README.md +14 -1
- data/docker/compose.yaml +33 -5
- data/docker/elasticsearch-follow.yml +14 -0
- data/docker/elasticsearch8plus.yml +1 -0
- data/lib/elastomer_client/client/ccr.rb +139 -0
- data/lib/elastomer_client/client/reindex.rb +2 -2
- data/lib/elastomer_client/client/rest_api_spec/api_spec_v8_17.rb +8161 -0
- data/lib/elastomer_client/client/rest_api_spec/api_spec_v8_18.rb +8456 -0
- data/lib/elastomer_client/version.rb +1 -1
- data/script/generate-rest-api-spec +1 -1
- data/script/setup-ccr +89 -0
- data/test/client/ccr_test.rb +149 -0
- data/test/client/cluster_test.rb +2 -1
- data/test/client/reindex_test.rb +6 -5
- data/test/test_helper.rb +13 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f424a09ec9e71ac45004cac7097fa874aa1b4c2275f2fc8e827f6d078115237
|
4
|
+
data.tar.gz: '0461827d35a1ddf9bd136fddfd5fd0f0a0ab1a9a6f1d6c78b937402670c30e66'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d621a224ee207f16683946ee37fef808c8132e119503d24b0465566b1040191ed01e3e342e7fcc6f58eadfcffa89ae20a523e969344cdcf4aad000ce84d1dfc
|
7
|
+
data.tar.gz: 0745ccbc186f42e2d68feb52eafed5712249358b3922dfeece1785d784a1e16ccc6fb3ecc3a0a0afc7d168cac8e8a267bb01745152705a39aceb57fafb73f121
|
data/.github/workflows/main.yml
CHANGED
@@ -12,11 +12,11 @@ jobs:
|
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
14
|
ruby-version: ['3.2']
|
15
|
-
ES_VERSION: ['8.
|
15
|
+
ES_VERSION: ['8.18.0']
|
16
16
|
include:
|
17
|
-
- ES_VERSION: '8.
|
17
|
+
- ES_VERSION: '8.18.0'
|
18
18
|
ES_DOWNLOAD_URL: >-
|
19
|
-
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.
|
19
|
+
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.18.0-linux-x86_64.tar.gz
|
20
20
|
steps:
|
21
21
|
- uses: ruby/setup-ruby@v1
|
22
22
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 6.2.3 (2025-06-06)
|
2
|
+
- Added support for ES 8.17.2
|
3
|
+
- Added support for ES 8.18.0
|
4
|
+
|
5
|
+
## 6.2.2 (2025-02-19)
|
6
|
+
- Add support for manually and automatically following indices for cross-cluster replication
|
7
|
+
|
1
8
|
## 6.2.1 (2024-12-10)
|
2
9
|
- Add support for rethrottling reindex tasks
|
3
10
|
|
data/README.md
CHANGED
@@ -110,7 +110,10 @@ end
|
|
110
110
|
This client is tested against:
|
111
111
|
|
112
112
|
- Ruby version 3.2
|
113
|
-
- Elasticsearch versions
|
113
|
+
- Elasticsearch versions:
|
114
|
+
- 5.6
|
115
|
+
- 8.13
|
116
|
+
- 8.18
|
114
117
|
|
115
118
|
## Development
|
116
119
|
|
@@ -142,6 +145,11 @@ To run ES 5 and ES 8:
|
|
142
145
|
docker compose --project-directory docker --profile all up
|
143
146
|
```
|
144
147
|
|
148
|
+
To run in ES8 cross cluster replication mode:
|
149
|
+
```
|
150
|
+
script/setup-ccr up "{non-production license}"
|
151
|
+
```
|
152
|
+
|
145
153
|
To run only ES 8:
|
146
154
|
```
|
147
155
|
docker compose --project-directory docker --profile es8 up
|
@@ -159,6 +167,11 @@ ES 8
|
|
159
167
|
ES_PORT=9208 rake test
|
160
168
|
```
|
161
169
|
|
170
|
+
CCR tests:
|
171
|
+
```
|
172
|
+
ES_PORT=9208 ES_REPLICA_PORT=9209 rake test
|
173
|
+
```
|
174
|
+
|
162
175
|
ES 5
|
163
176
|
```
|
164
177
|
ES_PORT=9205 rake test
|
data/docker/compose.yaml
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
version: "3"
|
2
2
|
|
3
3
|
services:
|
4
|
-
elasticsearch8.
|
5
|
-
image: docker.elastic.co/elasticsearch/elasticsearch:8.
|
6
|
-
container_name: es8.
|
7
|
-
profiles: ["es8", "all"]
|
4
|
+
elasticsearch8.18:
|
5
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.0
|
6
|
+
container_name: es8.18
|
7
|
+
profiles: ["es8", "ccr", "all"]
|
8
8
|
environment:
|
9
|
-
- cluster.name=elastomer8.
|
9
|
+
- cluster.name=elastomer8.18
|
10
10
|
- bootstrap.memory_lock=true
|
11
11
|
- discovery.type=single-node
|
12
12
|
- xpack.security.enabled=false
|
13
13
|
- xpack.watcher.enabled=false
|
14
14
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
15
|
+
- node.roles=[master,data,remote_cluster_client]
|
15
16
|
ulimits:
|
16
17
|
memlock:
|
17
18
|
soft: -1
|
@@ -28,6 +29,33 @@ services:
|
|
28
29
|
ports:
|
29
30
|
- 127.0.0.1:${ES_8_PORT:-9208}:9200
|
30
31
|
|
32
|
+
elasticsearchFollower:
|
33
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.0
|
34
|
+
container_name: es-follow
|
35
|
+
profiles: ["ccr"]
|
36
|
+
environment:
|
37
|
+
- cluster.name=es-follow
|
38
|
+
- bootstrap.memory_lock=true
|
39
|
+
- discovery.type=single-node
|
40
|
+
- xpack.security.enabled=false
|
41
|
+
- xpack.watcher.enabled=false
|
42
|
+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
43
|
+
- node.roles=[master,data,remote_cluster_client]
|
44
|
+
ulimits:
|
45
|
+
memlock:
|
46
|
+
soft: -1
|
47
|
+
hard: -1
|
48
|
+
nofile:
|
49
|
+
soft: 65536
|
50
|
+
hard: 65536
|
51
|
+
mem_limit: 2g
|
52
|
+
cap_add:
|
53
|
+
- IPC_LOCK
|
54
|
+
volumes:
|
55
|
+
- ./elasticsearch-follow.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
56
|
+
ports:
|
57
|
+
- 127.0.0.1:${ES_8_PORT:-9209}:9201
|
58
|
+
|
31
59
|
elasticsearch5.6:
|
32
60
|
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.4
|
33
61
|
container_name: es5.6
|
@@ -0,0 +1,14 @@
|
|
1
|
+
cluster.name: "es-follow"
|
2
|
+
|
3
|
+
network.host: 0.0.0.0
|
4
|
+
|
5
|
+
path:
|
6
|
+
data: /usr/share/elasticsearch/data
|
7
|
+
logs: /usr/share/elasticsearch/logs
|
8
|
+
repo: /usr/share/elasticsearch/repos
|
9
|
+
|
10
|
+
transport.port: 9301
|
11
|
+
http.port: 9201
|
12
|
+
remote_cluster.port: 9444
|
13
|
+
http.max_content_length: 50mb
|
14
|
+
ingest.geoip.downloader.enabled: false
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ElastomerClient
|
4
|
+
class Client
|
5
|
+
|
6
|
+
# Returns a CCR instance
|
7
|
+
def ccr
|
8
|
+
Ccr.new(self)
|
9
|
+
end
|
10
|
+
|
11
|
+
class Ccr
|
12
|
+
# Create a new Ccr for initiating requests for cross cluster replication.
|
13
|
+
# More context: https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-apis.html
|
14
|
+
#
|
15
|
+
# client - ElastomerClient::Client used for HTTP requests to the server
|
16
|
+
def initialize(client)
|
17
|
+
@client = client
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_reader :client
|
21
|
+
|
22
|
+
# Gets the parameters and status for each follower index.
|
23
|
+
#
|
24
|
+
# index_pattern - String name of the index pattern to get follower info for
|
25
|
+
# params - Hash of query parameters
|
26
|
+
#
|
27
|
+
# Examples
|
28
|
+
#
|
29
|
+
# ccr.get_follower_info("follower_index")
|
30
|
+
# ccr.get_follower_info("*")
|
31
|
+
#
|
32
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
|
33
|
+
def get_follower_info(index_pattern, params = {})
|
34
|
+
response = client.get "/#{index_pattern}/_ccr/info", params.merge(action: "get_follower_info", rest_api: "ccr")
|
35
|
+
response.body
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates a new follower index for the provided leader index on the remote cluster.
|
39
|
+
#
|
40
|
+
# follower_index - String name of the follower index to create
|
41
|
+
# body - Hash of the request body
|
42
|
+
# :remote_cluster - String name of the remote cluster. Required.
|
43
|
+
# :leader_index - String name of the leader index. Required.
|
44
|
+
# params - Hash of query parameters
|
45
|
+
#
|
46
|
+
# Examples
|
47
|
+
#
|
48
|
+
# ccr.follow("follower_index", { leader_index: "leader_index", remote_cluster: "leader" })
|
49
|
+
#
|
50
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
|
51
|
+
def follow(follower_index, body, params = {})
|
52
|
+
response = client.put "/#{follower_index}/_ccr/follow", params.merge(body:, action: "follow", rest_api: "ccr")
|
53
|
+
response.body
|
54
|
+
end
|
55
|
+
|
56
|
+
# Creates a new auto-follow pattern for the provided remote cluster.
|
57
|
+
#
|
58
|
+
# pattern_name - String name of the auto-follow pattern to create
|
59
|
+
# body - Hash of the request body
|
60
|
+
# :remote_cluster - String name of the remote cluster. Required.
|
61
|
+
# :leader_index_patterns - An array of simple index patterns to match against indices in the remote cluster
|
62
|
+
# :leader_index_exclusion_patterns - An array of simple index patterns that can be used to exclude indices from being auto-followed.
|
63
|
+
# :follow_index_pattern - The name of follower index. The template {{leader_index}} can be used to derive
|
64
|
+
# the name of the follower index from the name of the leader index.
|
65
|
+
# params - Hash of query parameters
|
66
|
+
|
67
|
+
# Examples
|
68
|
+
|
69
|
+
# ccr.auto_follow("follower_pattern", { remote_cluster: "leader", leader_index_patterns: ["leader_index*"],
|
70
|
+
# follow_index_pattern: "{{leader_index}}-follower" })
|
71
|
+
|
72
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html
|
73
|
+
|
74
|
+
def auto_follow(pattern_name, body, params = {})
|
75
|
+
response = client.put "/_ccr/auto_follow/#{pattern_name}", params.merge(body:, action: "create_auto_follow_pattern", rest_api: "ccr")
|
76
|
+
response.body
|
77
|
+
end
|
78
|
+
|
79
|
+
# Deletes the auto-follow pattern for the provided remote cluster.
|
80
|
+
#
|
81
|
+
# pattern_name - String name of the auto-follow pattern to delete
|
82
|
+
# params - Hash of query parameters
|
83
|
+
#
|
84
|
+
# Examples
|
85
|
+
#
|
86
|
+
# ccr.delete_auto_follow("follower_pattern")
|
87
|
+
#
|
88
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html
|
89
|
+
|
90
|
+
def delete_auto_follow(pattern_name, params = {})
|
91
|
+
response = client.delete "/_ccr/auto_follow/#{pattern_name}", params.merge(action: "delete_auto_follow_pattern", rest_api: "ccr")
|
92
|
+
response.body
|
93
|
+
end
|
94
|
+
|
95
|
+
# Gets cross-cluster replication auto-follow patterns
|
96
|
+
#
|
97
|
+
# params - Hash of query parameters
|
98
|
+
# :pattern_name - (Optional) String name of the auto-follow pattern. Returns all patterns if not specified
|
99
|
+
# Examples
|
100
|
+
#
|
101
|
+
# ccr.get_auto_follow
|
102
|
+
#
|
103
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html
|
104
|
+
|
105
|
+
def get_auto_follow(params = {})
|
106
|
+
response = client.get "/_ccr/auto_follow{/pattern_name}", params.merge(action: "get_auto_follow_pattern", rest_api: "ccr")
|
107
|
+
response.body
|
108
|
+
end
|
109
|
+
|
110
|
+
# Pauses a follower index.
|
111
|
+
#
|
112
|
+
# follower_index - String name of the follower index to pause
|
113
|
+
# params - Hash of the request body
|
114
|
+
#
|
115
|
+
# Examples
|
116
|
+
# ccr.pause_follow("follower_index")
|
117
|
+
#
|
118
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html
|
119
|
+
def pause_follow(follower_index, params = {})
|
120
|
+
response = client.post "/#{follower_index}/_ccr/pause_follow", params.merge(action: "pause_follow", rest_api: "ccr")
|
121
|
+
response.body
|
122
|
+
end
|
123
|
+
|
124
|
+
# Unfollows a leader index given a follower index.
|
125
|
+
# The follower index must be paused and closed before unfollowing.
|
126
|
+
#
|
127
|
+
# follower_index - String name of the follower index to unfollow
|
128
|
+
# params - Hash of the request body
|
129
|
+
#
|
130
|
+
# Examples
|
131
|
+
# ccr.unfollow("follower_index")
|
132
|
+
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html
|
133
|
+
def unfollow(follower_index, params = {})
|
134
|
+
response = client.post "/#{follower_index}/_ccr/unfollow", params.merge(action: "unfollow", rest_api: "ccr")
|
135
|
+
response.body
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -20,12 +20,12 @@ module ElastomerClient
|
|
20
20
|
attr_reader :client
|
21
21
|
|
22
22
|
def reindex(body, params = {})
|
23
|
-
response = client.post "/_reindex", params.merge(
|
23
|
+
response = client.post "/_reindex", params.merge(body:, action: "reindex", rest_api: "reindex")
|
24
24
|
response.body
|
25
25
|
end
|
26
26
|
|
27
27
|
def rethrottle(task_id, params = {})
|
28
|
-
response = client.post "/_reindex/#{task_id}/_rethrottle", params.merge(
|
28
|
+
response = client.post "/_reindex/#{task_id}/_rethrottle", params.merge(action: "rethrottle", rest_api: "reindex")
|
29
29
|
response.body
|
30
30
|
end
|
31
31
|
|