elastomer-client 6.2.0 → 6.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b966e96aa32c1487f48b7f45d4ab898b32ff1c9fa550b73c2da8bb47c177d4a
4
- data.tar.gz: 4176c15e54bd0bc60fccae3f3c9be46820000483b7f78c1076267ea96274c050
3
+ metadata.gz: 49da91bf2c259b9b77ed76d66fa001aa4192432225090bb62ff9d74f8173f8dc
4
+ data.tar.gz: 2d519500cced0a8783a9fd5b77853d935cc3b99f35e8be981e5e1e23b55d9632
5
5
  SHA512:
6
- metadata.gz: 41d3666f7c2117a0ede3517be94a87e9fb5d706611f611c938a65b71ea4eb639426c75a9e0c46f225cf0806744d3fd617b3519c220139e3eb5d80fcf9bd20172
7
- data.tar.gz: 301926969a5771b04f62d3cc0ed3dbf148befee0c37f9fa438d131faf6187f8dee8f331c37db3c3be87e78e4319cedda9642b3146f5f3f405e171d57f909c6b7
6
+ metadata.gz: 2f0f879414271cf6f861bfcf256ec6af824a60c2603dbb48dc2297ecffae55f969e7947e8c9cfc0469239c15fe4b9754721279886def527eb89658a549f085fb
7
+ data.tar.gz: 42cd80d2c67d119767451b524543f73cc1af3ffda4088186cfac8daa99970849655c05ed5382e7ab689a71e1a5c8e4c6b620fbaf66a91693e4afad7e186900ff
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
+ ## 6.2.1 (2024-12-10)
2
+ - Add support for rethrottling reindex tasks
3
+
1
4
  ## 6.2.0 (2024-11-06)
2
- - Added support for reindex API
3
- - Removed CI checks for ES 5.6.15
5
+ - Add support for reindex API
6
+ - Remove CI checks for ES 5.6.15
4
7
 
5
8
  ## 6.1.1 (2024-06-05)
6
9
  - Unlock faraday_middleware version to allow 1.x
@@ -24,6 +24,11 @@ module ElastomerClient
24
24
  response.body
25
25
  end
26
26
 
27
+ def rethrottle(task_id, params = {})
28
+ response = client.post "/_reindex/#{task_id}/_rethrottle", params.merge(params, action: "rethrottle", rest_api: "reindex")
29
+ response.body
30
+ end
31
+
27
32
  end
28
33
  end
29
34
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ElastomerClient
4
- VERSION = "6.2.0"
4
+ VERSION = "6.2.1"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -49,6 +49,30 @@ describe ElastomerClient::Client::Reindex do
49
49
  assert_equal "Book 1", doc["_source"]["title"]
50
50
  end
51
51
 
52
+ it "successfully rethrottles a reindex task" do
53
+ reindex = $client.reindex
54
+ body = {
55
+ source: { index: @source_index.name },
56
+ dest: { index: @dest_index.name }
57
+ }
58
+ response = reindex.reindex(body, requests_per_second: 0.01, wait_for_completion: false)
59
+ task_id = response["task"]
60
+
61
+ reindex.rethrottle(task_id, requests_per_second: 1)
62
+
63
+ tasks = $client.tasks
64
+ node_id = task_id.split(":").first
65
+ task_id = task_id.split(":").last.to_i
66
+
67
+ # wait for the task to complete
68
+ tasks.wait_by_id(node_id, task_id, "30s")
69
+
70
+ # Verify that the document has been reindexed
71
+ doc = @dest_index.docs.get(id: 1, type: "book")
72
+
73
+ assert_equal "Book 1", doc["_source"]["title"]
74
+ end
75
+
52
76
  it "creates a new index when the destination index does not exist" do
53
77
  reindex = $client.reindex
54
78
  body = {
@@ -69,7 +93,7 @@ describe ElastomerClient::Client::Reindex do
69
93
  }
70
94
 
71
95
  exception = assert_raises(ElastomerClient::Client::RequestError) do
72
- response = reindex.reindex(body)
96
+ reindex.reindex(body)
73
97
  end
74
98
  assert_equal(404, exception.status)
75
99
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastomer-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-11-08 00:00:00.000000000 Z
12
+ date: 2024-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable