Skip to content

Introduce cross-cluster replication API docs #34726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ buildRestTests.setups['host'] = '''
- do:
nodes.info:
metric: [ http, transport ]
- is_true: nodes.$master.http.publish_address
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed because it is now used in the setup section of some of the docs tests, and setup sections do not support is_true sections. While we could add support for is_true sections to setup section, this assertion is adding little value to begin with.

- set: {nodes.$master.http.publish_address: host}
- set: {nodes.$master.transport.publish_address: transport_host}
'''
Expand Down Expand Up @@ -1093,4 +1092,21 @@ buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['cale
]}
'''

buildRestTests.setups['leader_cluster'] = buildRestTests.setups['host'] + '''
- do:
cluster.put_settings:
body:
persistent:
cluster.remote.leader_cluster.seeds: $transport_host
'''

buildRestTests.setups['leader_cluster_and_leader_index'] = buildRestTests.setups['leader_cluster'] + '''
- do:
indices.create:
index: leader_index
body:
settings:
index.number_of_replicas: 0
index.number_of_shards: 1
index.soft_deletes.enabled: true
'''
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[role="xpack"]
[testenv="platinum"]
[[ccr-delete-auto-follow-pattern]]
=== Delete Auto-Follow Pattern API
++++
<titleabbrev>Delete Auto-Follow Pattern</titleabbrev>
++++

Delete auto-follow patterns.

==== Description

This API deletes configured auto-follow patterns.

==== Request

//////////////////////////

[source,js]
--------------------------------------------------
PUT /_ccr/auto_follow/my_auto_follow_pattern
{
"leader_cluster" : "leader_cluster",
"leader_index_patterns" :
[
"leader_index"
],
"follow_index_pattern" : "{{leader_index}}-follower"
}
--------------------------------------------------
// CONSOLE
// TEST[setup:leader_cluster]
// TESTSETUP

//////////////////////////

[source,js]
--------------------------------------------------
DELETE /_ccr/auto_follow/<auto_follow_pattern_name>
--------------------------------------------------
// CONSOLE
// TEST[s/<auto_follow_pattern_name>/my_auto_follow_pattern/]

Here, the auto-follow patterns associated with the
<<modules-remote-clusters,remote cluster>> specified by `<leader_cluster>`
will be deleted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
==== Path Parameters
`auto_follow_pattern_name` (required)::
(string) Specifies auto-follow patterns that you want to delete.

==== Example

The following is an example of using the delete auto-follow pattern API.
Copy link
Contributor

@lcawl lcawl Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following is an example of using the delete auto-follow pattern API.
This example deletes an auto-follow pattern named `my_auto_follow_pattern`:


[source,js]
--------------------------------------------------
DELETE /_ccr/auto_follow/my_auto_follow_pattern
--------------------------------------------------
// CONSOLE
// TEST[setup:leader_cluster]

The API returns the following result:

[source,js]
--------------------------------------------------
{
"acknowledged" : true
}
--------------------------------------------------
// TESTRESPONSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[role="xpack"]
[testenv="platinum"]
[[ccr-get-auto-follow-pattern]]
=== Get Auto-Follow Pattern API
++++
<titleabbrev>Get Auto-Follow Pattern</titleabbrev>
++++

Get auto-follow patterns.

==== Description

This API gets configured auto-follow patterns. This API will return the
specified auto-follow pattern collection.

==== Request

//////////////////////////

[source,js]
--------------------------------------------------
PUT /_ccr/auto_follow/my_auto_follow_pattern
{
"leader_cluster" : "leader_cluster",
"leader_index_patterns" :
[
"leader_index*"
],
"follow_index_pattern" : "{{leader_index}}-follower"
}
--------------------------------------------------
// CONSOLE
// TEST[setup:leader_cluster]
// TESTSETUP

[source,js]
--------------------------------------------------
DELETE /_ccr/auto_follow/my_auto_follow_pattern
--------------------------------------------------
// CONSOLE
// TEST
// TEARDOWN

//////////////////////////

[source,js]
--------------------------------------------------
GET /_ccr/auto_follow/
--------------------------------------------------
// CONSOLE

Here, all auto-follow patterns will be returned.

[source,js]
--------------------------------------------------
GET /_ccr/auto_follow/<auto_follow_pattern_name>
--------------------------------------------------
// CONSOLE
// TEST[s/<auto_follow_pattern_name>/my_auto_follow_pattern/]

Here, the named auto-follow pattern collection specified by
`<auto_follow_pattern_name>` will be returned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
==== Path Parameters
`auto_follow_pattern_name` ::
(string) Specifies the auto-follow patterns that you want to retrieve. If you do not specify any patterns, the API returns information for all patterns.

==== Example

The following is an example of using the get auto-follow pattern API.
Copy link
Contributor

@lcawl lcawl Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following is an example of using the get auto-follow pattern API.
This example retrieves information about an auto-follow pattern named `my_auto_follow_pattern`:


[source,js]
--------------------------------------------------
GET /_ccr/auto_follow/my_auto_follow_pattern
--------------------------------------------------
// CONSOLE
// TEST[setup:leader_cluster]

The API returns the following result:

[source,js]
--------------------------------------------------
{
"my_auto_follow_pattern" :
{
"leader_cluster" : "leader_cluster",
"leader_index_patterns" :
[
"leader_index*"
],
"follow_index_pattern" : "{{leader_index}}-follower"
}
}
--------------------------------------------------
// TESTRESPONSE
48 changes: 48 additions & 0 deletions docs/reference/ccr/apis/auto-follow/get-auto-follow-stats.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[role="xpack"]
[testenv="platinum"]
[[ccr-get-auto-follow-stats]]
=== Get Auto-Follow Stats API
++++
<titleabbrev>Get Auto-Follow Stats</titleabbrev>
++++

Get auto-follow stats.

==== Description

This API gets stats about auto-follow patterns.

==== Request

[source,js]
--------------------------------------------------
GET /_ccr/auto_follow/stats
--------------------------------------------------
// CONSOLE
// TEST

Here, stats about auto-follow patterns will be returned.

==== Example

The following is an example of using the get auto-follow stats API.
Copy link
Contributor

@lcawl lcawl Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following is an example of using the get auto-follow stats API.
This example retrieves stats about auto-follow patterns:


[source,js]
--------------------------------------------------
GET /_ccr/auto_follow/stats
--------------------------------------------------
// CONSOLE
// TEST

The API returns the following result:

[source,js]
--------------------------------------------------
{
"number_of_successful_follow_indices" : 16,
"number_of_failed_follow_indices" : 0,
"number_of_failed_remote_cluster_state_requests" : 0,
"recent_auto_follow_errors" : [ ]
}
--------------------------------------------------
// TESTRESPONSE[s/"number_of_successful_follow_indices" : 16/"number_of_successful_follow_indices" : $body.number_of_successful_follow_indices/]
113 changes: 113 additions & 0 deletions docs/reference/ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
[role="xpack"]
[testenv="platinum"]
[[ccr-put-auto-follow-pattern]]
=== Create Auto-Follow Pattern API
++++
<titleabbrev>Create Auto-Follow Pattern</titleabbrev>
++++

Creates an auto-follow pattern.

==== Description

This API creates a new named collection of auto-follow patterns against the
remote cluster specified in the request body. Newly created indices on the
remote cluster matching any of the specified patterns will be automatically
configured as follower indices.

==== Request

[source,js]
--------------------------------------------------
PUT /_ccr/auto_follow/<auto_follow_pattern_name>
{
"leader_cluster" : "<leader_cluster>",
"leader_index_patterns" :
[
"<leader_index_pattern>"
],
"follow_index_pattern" : "<follow_index_pattern>"
}
--------------------------------------------------
// CONSOLE
// TEST[setup:leader_cluster]
// TEST[s/<auto_follow_pattern_name>/auto_follow_pattern_name/]
// TEST[s/<leader_cluster>/leader_cluster/]
// TEST[s/<leader_index_patterns>/leader_index*/]
// TEST[s/<follow_index_pattern>/{{leader_index}}-follower/]

//////////////////////////

[source,js]
--------------------------------------------------
DELETE /_ccr/auto_follow/auto_follow_pattern_name
--------------------------------------------------
// CONSOLE
// TEST[continued]

//////////////////////////

Here, `<auto_follow_pattern_name>` is a user-chosen name for the collection of
auto-follow patterns being created, `<leader_cluster>` is the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there rules for what this name can contain? For example, for job names, we say "This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters."

<<modules-remote-clusters,remote cluster>> containing the leader indices to
match against, `<leader_index_pattern>` is a simple index pattern to match
against indices in the remote cluster, and `<follow_index_pattern>` is the
pattern to use to name the resulting follower indices. The
`<follow_index_pattern>` can use the template `{{leader_index}}` to refer to the
name of the leader index being followed.

Copy link
Contributor

@lcawl lcawl Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
==== Path Parameters
`auto_follow_pattern_name` (required)::
(string) Identifier for the auto-follow patterns.

==== Request Body
`leader_cluster`::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`leader_cluster`::
`leader_cluster` (required) ::

(required string) the <<modules-remote-clusters,remote cluster>> containing the
Copy link
Contributor

@lcawl lcawl Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(required string) the <<modules-remote-clusters,remote cluster>> containing the
(string) The <<modules-remote-clusters,remote cluster>> containing the

leader indices to match against

`leader_index_patterns`::
(array) an array of simple index patterns to match against indices in the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(array) an array of simple index patterns to match against indices in the
(array) An array of simple index patterns to match against indices in the

remote cluster specified by the `leader_cluster` field

`follow_index_pattern`::
(string) the name of follower index; the template `{{leader_index}}` can be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(string) the name of follower index; the template `{{leader_index}}` can be
(string) The name of follower index; the template `{{leader_index}}` can be

used to derive the name of the follower index from the name of the leader
index

include::../follow-request-body.asciidoc[]

==== Example

The following is an example of using the create auto-follow pattern API.
Copy link
Contributor

@lcawl lcawl Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following is an example of using the create auto-follow pattern API.
This example creates an auto-follow pattern named `my_auto_follow_pattern`:


[source,js]
--------------------------------------------------
PUT /_ccr/auto_follow/my_auto_follow_pattern
{
"leader_cluster" : "leader_cluster",
"leader_index_patterns" :
[
"leader_index*"
],
"follow_index_pattern" : "{{leader_index}}-follower"
}
--------------------------------------------------
// CONSOLE
// TEST[setup:leader_cluster]

The API returns the following result:

[source,js]
--------------------------------------------------
{
"acknowledged" : true
}
--------------------------------------------------
// TESTRESPONSE

//////////////////////////

[source,js]
--------------------------------------------------
DELETE /_ccr/auto_follow/my_auto_follow_pattern
--------------------------------------------------
// CONSOLE
// TEST[continued]

//////////////////////////
38 changes: 38 additions & 0 deletions docs/reference/ccr/apis/ccr-apis.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[role="xpack"]
[testenv="platinum"]
[[ccr-apis]]
== Cross-cluster replication APIs

You can use the following APIs to perform {ccr} operations.

[float]
[[ccr-api-follow]]
=== Follow

* <<ccr-put-follow,Create follower index>>
* <<ccr-post-pause-follow,Pause follower>>
* <<ccr-post-resume-follow,Resume follower>>
* <<ccr-post-unfollow,Convert follower index to a regular index>>
* <<ccr-get-follow-stats,Get stats about follower indices>>

[float]
[[ccr-api-auto-follow]]
=== Auto-follow

* <<ccr-put-auto-follow-pattern,Create auto-follow pattern>>
* <<ccr-delete-auto-follow-pattern,Delete auto-follow pattern>>
* <<ccr-get-auto-follow-pattern,Get auto-follow patterns>>
* <<ccr-get-auto-follow-stats,Get stats about auto-follow patterns>>

// follow
include::follow/put-follow.asciidoc[]
include::follow/post-pause-follow.asciidoc[]
include::follow/post-resume-follow.asciidoc[]
include::follow/post-unfollow.asciidoc[]
include::follow/get-follow-stats.asciidoc[]

// auto-follow
include::auto-follow/put-auto-follow-pattern.asciidoc[]
include::auto-follow/delete-auto-follow-pattern.asciidoc[]
include::auto-follow/get-auto-follow-pattern.asciidoc[]
include::auto-follow/get-auto-follow-stats.asciidoc[]
Loading