Class: ElastomerClient::Client::Ccr
- Inherits:
-
Object
- Object
- ElastomerClient::Client::Ccr
- Defined in:
- lib/elastomer_client/client/ccr.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #auto_follow(pattern_name, body, params = {}) ⇒ Object
-
#delete_auto_follow(pattern_name, params = {}) ⇒ Object
Deletes the auto-follow pattern for the provided remote cluster.
-
#follow(follower_index, body, params = {}) ⇒ Object
Creates a new follower index for the provided leader index on the remote cluster.
-
#get_auto_follow(params = {}) ⇒ Object
Gets cross-cluster replication auto-follow patterns.
-
#get_follower_info(index_pattern, params = {}) ⇒ Object
Gets the parameters and status for each follower index.
-
#initialize(client) ⇒ Ccr
constructor
Create a new Ccr for initiating requests for cross cluster replication.
-
#pause_follow(follower_index, params = {}) ⇒ Object
Pauses a follower index.
-
#unfollow(follower_index, params = {}) ⇒ Object
Unfollows a leader index given a follower index.
Constructor Details
#initialize(client) ⇒ Ccr
Create a new Ccr for initiating requests for cross cluster replication. More context: www.elastic.co/guide/en/elasticsearch/reference/current/ccr-apis.html
client - ElastomerClient::Client used for HTTP requests to the server
16 17 18 |
# File 'lib/elastomer_client/client/ccr.rb', line 16 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
20 21 22 |
# File 'lib/elastomer_client/client/ccr.rb', line 20 def client @client end |
Instance Method Details
#auto_follow(pattern_name, body, params = {}) ⇒ Object
74 75 76 77 |
# File 'lib/elastomer_client/client/ccr.rb', line 74 def auto_follow(pattern_name, body, params = {}) response = client.put "/_ccr/auto_follow/#{pattern_name}", params.merge(body:, action: "create_auto_follow_pattern", rest_api: "ccr") response.body end |
#delete_auto_follow(pattern_name, params = {}) ⇒ Object
Deletes the auto-follow pattern for the provided remote cluster.
pattern_name - String name of the auto-follow pattern to delete params - Hash of query parameters
Examples
ccr.delete_auto_follow("follower_pattern")
See www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html
90 91 92 93 |
# File 'lib/elastomer_client/client/ccr.rb', line 90 def delete_auto_follow(pattern_name, params = {}) response = client.delete "/_ccr/auto_follow/#{pattern_name}", params.merge(action: "delete_auto_follow_pattern", rest_api: "ccr") response.body end |
#follow(follower_index, body, params = {}) ⇒ Object
Creates a new follower index for the provided leader index on the remote cluster.
follower_index - String name of the follower index to create body - Hash of the request body
:remote_cluster - String name of the remote cluster. Required.
:leader_index - String name of the leader index. Required.
params - Hash of query parameters
Examples
ccr.follow("follower_index", { leader_index: "leader_index", remote_cluster: "leader" })
See www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
51 52 53 54 |
# File 'lib/elastomer_client/client/ccr.rb', line 51 def follow(follower_index, body, params = {}) response = client.put "/#{follower_index}/_ccr/follow", params.merge(body:, action: "follow", rest_api: "ccr") response.body end |
#get_auto_follow(params = {}) ⇒ Object
Gets cross-cluster replication auto-follow patterns
params - Hash of query parameters
:pattern_name - (Optional) String name of the auto-follow pattern. Returns all patterns if not specified
Examples
ccr.get_auto_follow
See www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html
105 106 107 108 |
# File 'lib/elastomer_client/client/ccr.rb', line 105 def get_auto_follow(params = {}) response = client.get "/_ccr/auto_follow{/pattern_name}", params.merge(action: "get_auto_follow_pattern", rest_api: "ccr") response.body end |
#get_follower_info(index_pattern, params = {}) ⇒ Object
Gets the parameters and status for each follower index.
index_pattern - String name of the index pattern to get follower info for params - Hash of query parameters
Examples
ccr.get_follower_info("follower_index")
ccr.get_follower_info("*")
See www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
33 34 35 36 |
# File 'lib/elastomer_client/client/ccr.rb', line 33 def get_follower_info(index_pattern, params = {}) response = client.get "/#{index_pattern}/_ccr/info", params.merge(action: "get_follower_info", rest_api: "ccr") response.body end |
#pause_follow(follower_index, params = {}) ⇒ Object
Pauses a follower index.
follower_index - String name of the follower index to pause params - Hash of the request body
Examples
ccr.pause_follow("follower_index")
See www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html
119 120 121 122 |
# File 'lib/elastomer_client/client/ccr.rb', line 119 def pause_follow(follower_index, params = {}) response = client.post "/#{follower_index}/_ccr/pause_follow", params.merge(action: "pause_follow", rest_api: "ccr") response.body end |
#unfollow(follower_index, params = {}) ⇒ Object
Unfollows a leader index given a follower index. The follower index must be paused and closed before unfollowing.
follower_index - String name of the follower index to unfollow params - Hash of the request body
Examples
ccr.unfollow("follower_index")
See www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html
133 134 135 136 |
# File 'lib/elastomer_client/client/ccr.rb', line 133 def unfollow(follower_index, params = {}) response = client.post "/#{follower_index}/_ccr/unfollow", params.merge(action: "unfollow", rest_api: "ccr") response.body end |