elasticsearch/docs/reference
Lee Hinman 3420be0ca5
Fix renaming data streams with CCR replication (#88875)
This commit fixes the situation where a user wants to use CCR to replicate indices that are part of
a data stream while renaming the data stream. For example, assume a user has an auto-follow request
that looks like this:

```
PUT /_ccr/auto_follow/my-auto-follow-pattern
{
  "remote_cluster" : "other-cluster",
  "leader_index_patterns" : ["logs-*"],
  "follow_index_pattern" : "{{leader_index}}_copy"
}
```

And then the data stream `logs-mysql-error` was created, creating the backing index
`.ds-logs-mysql-error-2022-07-29-000001`.

Prior to this commit, replicating this data stream means that the backing index would be renamed to
`.ds-logs-mysql-error-2022-07-29-000001_copy` and the data stream would *not* be renamed. This
caused a check to trip in `TransportPutLifecycleAction` asserting that a backing index was not
renamed for a data stream during following.

After this commit, there are a couple of changes:

First, the data stream will also be renamed. This means that the `logs-mysql-error` becomes
`logs-mysql-error_copy` when created on the follower cluster. Because of the way that CCR works,
this means we need to support renaming a data stream for a regular "create follower" request, so a
new parameter has been added: `data_stream_name`. It works like this:

```
PUT /mynewindex/_ccr/follow
{
  "remote_cluster": "other-cluster",
  "leader_index": "myotherindex",
  "data_stream_name": "new_ds"
}
```

Second, the backing index for a data stream must be renamed in a way that does not break the parsing
of a data stream backing pattern, whereas previously the index
`.ds-logs-mysql-error-2022-07-29-000001` would be renamed to
`.ds-logs-mysql-error-2022-07-29-000001_copy` (an illegal name since it doesn't end with the
rollover digit), after this commit it will be renamed to
`.ds-logs-mysql-error_copy-2022-07-29-000001` to match the renamed data stream. This means that for
the given `follow_index_pattern` of `{{leader_index}}_copy` the index changes look like:

| Leader Cluster | Follower Cluster |
|--------------|-----------|
| `logs-mysql-error` (data stream) | `logs-mysql-error_copy` (data stream) |
| `.ds-logs-mysql-error-2022-07-29-000001`      | `.ds-logs-mysql-error_copy-2022-07-29-000001` |

Which internally means the auto-follow request turned into the create follower request of:

```
PUT /.ds-logs-mysql-error_copy-2022-07-29-000001/_ccr/follow
{
  "remote_cluster": "other-cluster",
  "leader_index": ".ds-logs-mysql-error-2022-07-29-000001",
  "data_stream_name": "logs-mysql-error_copy"
}
```

Relates to https://github.com/elastic/elasticsearch/pull/84940 (cherry-picked the commit for a test)
Relates to https://github.com/elastic/elasticsearch/pull/61993 (where data stream support was first introduced for CCR)
Resolves https://github.com/elastic/elasticsearch/issues/81751
2022-08-01 09:17:50 -06:00
..
aggregations [ML] Make bucket_count_ks_test aggregation generally available (#88657) 2022-07-25 13:30:48 -04:00
analysis [DOCS] Add note for tokenizers that don't support keep types token filter (#87553) 2022-06-13 11:28:32 +02:00
autoscaling [DOCS] Document autoscaling processors (#88248) 2022-07-05 13:51:51 +02:00
cat Move the ingest attachment processor to the default distribution (#87989) 2022-06-28 02:10:36 -04:00
ccr Fix renaming data streams with CCR replication (#88875) 2022-08-01 09:17:50 -06:00
cluster Support "dry run" mode for updating Desired Nodes (#88305) 2022-07-26 09:03:12 +02:00
commands Fix some typos in plugins & reference docs (#84667) 2022-03-07 12:29:58 -05:00
data-management [DOC] auto migrate only for default template (#82043) 2022-05-10 11:35:19 -04:00
data-streams Added additional index.look_ahead_time validation (#87847) 2022-06-21 10:50:33 +02:00
docs Docs: Data streams only support create (#87263) 2022-06-08 13:41:42 -04:00
eql [DOCS] Fix link to AtomicRed JSON file (#88817) 2022-07-26 10:54:18 -07:00
features/apis Make feature reset API response more informative (#71240) 2021-04-27 13:47:10 -04:00
fleet Fix some typos in plugins & reference docs (#84667) 2022-03-07 12:29:58 -05:00
graph [DOCS] Fix typos (#83895) 2022-02-15 12:42:17 -05:00
health Removing the notion of components from the health API (#88663) 2022-07-25 12:29:06 -05:00
high-availability [DOCS] Overhaul snapshot and restore docs (#79081) 2021-11-15 12:45:07 -05:00
how-to [DOCS] Warn about impact of large readahead on search (#88007) 2022-06-27 13:00:44 +03:00
ilm Fix byte unit typo in ILM rollover doc (#87780) 2022-06-23 09:33:47 +02:00
images Add troubleshooting guide for corrupt repository (#88391) 2022-07-14 13:37:02 +01:00
index-modules [DOCS] Fix typos in docs (#88226) 2022-07-05 11:02:29 +02:00
indices Support kNN vectors in disk usage action (#88785) 2022-07-26 07:57:47 -07:00
ingest [DOCS] Fixes a link that breaks the docs build. (#88111) 2022-06-28 10:22:23 +02:00
licensing [DOCS] Remove testenv annotations from doc snippet tests (#80023) 2021-11-05 18:38:50 -04:00
mapping Update synthetic-source.asciidoc (#88880) 2022-07-28 10:35:10 +03:00
migration Deprecate overriding DiscoveryPlugin internals (#88925) 2022-07-30 06:30:34 +09:30
ml [ML] Fix version substitution in put DFA docs (#88862) 2022-07-28 01:37:30 +09:30
modules Fix typo (missing word) (#88034) 2022-07-28 00:53:35 +09:30
monitoring [DOCS] Adding Getting Help section to troubleshooting docs (#87095) 2022-05-25 15:58:41 -04:00
query-dsl [DOCS] Remove camel case variations (#88650) 2022-07-20 17:06:34 +02:00
release-notes Add release notes for 8.3.3 (#88599) 2022-07-25 11:06:29 +01:00
repositories-metering-api [DOCS] Remove testenv annotations from doc snippet tests (#80023) 2021-11-05 18:38:50 -04:00
rest-api Remove suggest flag from index stats docs (#85479) 2022-07-14 12:50:53 -04:00
rollup [DOCS] Remove testenv annotations from doc snippet tests (#80023) 2021-11-05 18:38:50 -04:00
scripting [Docs] Fix runtime grok script example (#87851) 2022-07-05 10:53:24 -04:00
search Update rank-eval.asciidoc (#88771) 2022-07-25 18:00:49 +02:00
searchable-snapshots [Doc] Precise that shared cache is shared across shards, not nodes (#88834) 2022-07-27 10:10:01 +02:00
settings Documenting master_is_stable health API settings (#87901) 2022-07-26 12:02:38 -05:00
setup Add build_flavor back to info api rest response (#88336) 2022-07-08 09:54:29 +09:30
shutdown/apis [doc] Explicitly mention about node shutdown remove for cluster shrink (#86173) 2022-05-09 10:24:54 +02:00
slm/apis [DOCS] Remove soft limit for snapshot repositories (#80745) 2021-11-16 12:24:18 -05:00
snapshot-restore Add pagination parameters to API spec and docs for 'snapshot.get' API 2022-07-20 06:35:52 -05:00
sql [DOCS] Fix typos in docs (#88226) 2022-07-05 11:02:29 +02:00
tab-widgets Troubleshooting docs for ACTION_RESTORE_FROM_SNAPSHOT (#87692) 2022-07-27 23:37:08 +09:30
text-structure/apis [DOCS] Remove testenv annotations from doc snippet tests (#80023) 2021-11-05 18:38:50 -04:00
transform [DOCS] Fix transform painless example syntax (#88364) 2022-07-21 08:05:17 -07:00
troubleshooting Add troubleshooting docs about data corruption (#88760) 2022-07-28 11:23:23 +01:00
upgrade Docs for snapshots as simple archives (#86261) 2022-05-30 13:23:53 +02:00
vectors [DOCS] Remove testenv annotations from doc snippet tests (#80023) 2021-11-05 18:38:50 -04:00
aggregations.asciidoc Convert bucket aggs docs to runtime fields (#71202) 2021-04-02 12:12:06 -04:00
alias.asciidoc [DOCS] Fix default for is_write_index (#77006) (#77362) 2021-09-07 11:34:53 -04:00
analysis.asciidoc Update Lucene analysis base url (#84094) 2022-02-17 12:44:12 +01:00
api-conventions.asciidoc Fix a typo in api-conventions example (#88056) 2022-06-27 13:58:51 -04:00
cat.asciidoc [DOCS] Remove unneeded escapes 2021-04-26 12:14:45 -04:00
cluster.asciidoc How-to docs for increasing the total number of shards per node (#86214) 2022-05-10 09:13:27 +01:00
data-management.asciidoc reorder and merge data management and ILM doc pages (#84679) 2022-03-07 18:33:28 -05:00
data-rollup-transform.asciidoc [DOCS] Remove ifdefs for rollup refactor 2021-08-05 09:08:04 -04:00
datatiers.asciidoc [DOCS] Fix duplicate anchor (#85424) 2022-03-28 15:16:08 -07:00
dependencies-versions.asciidoc [DOCS] Added appendix to show dependencies (#67962) 2021-01-26 16:16:05 -08:00
docs.asciidoc [DOCS] Update single index APIs reference (#73103) 2021-05-14 11:53:34 -04:00
gs-index.asciidoc [DOCS] Adding index file for GS "mini book". 2017-07-18 13:44:08 -07:00
high-availability.asciidoc [DOCS] Overhaul snapshot and restore docs (#79081) 2021-11-15 12:45:07 -05:00
how-to.asciidoc Move fix common cluster issues to troubleshooting (#87440) 2022-06-13 17:16:17 -07:00
index-extra-title-page.html [DOCS] Add index-extra-title-page.html for direct HTML migration (#50189) 2019-12-13 12:44:12 -05:00
index-modules.asciidoc Troubleshooting guides for disabled allocations (#86789) 2022-05-24 10:27:15 +01:00
index.asciidoc [DOCS] Remove ES quickstart. (#87939) 2022-06-23 14:25:48 -07:00
index.x.asciidoc [DOCS] Removes redundant index.asciidoc files (#30707) 2018-05-18 11:05:40 -07:00
indices.asciidoc Remove endpoint for freezing indices (#78918) 2021-10-26 06:37:56 -05:00
ingest.asciidoc Ingest: IngestDocument requires non-null version (#87665) 2022-06-15 07:50:45 -05:00
intro.asciidoc [DOCS] Update ES intro for stretched clusters (#77651) 2021-09-13 16:50:08 -04:00
links.asciidoc [DOCS] Rename ES Reference to ES Guide (#71198) 2021-04-01 15:38:41 -04:00
mapping.asciidoc Minor revision missed in merge. (#67282) 2021-01-11 13:50:06 -05:00
query-dsl.asciidoc Allow doc-values only search on geo_point fields (#83395) 2022-02-02 11:56:19 +01:00
redirects.asciidoc [DOCS] Add minimal security steps back to docs (#88393) 2022-07-19 10:01:34 -04:00
release-notes.asciidoc Add release notes for 8.3.3 (#88599) 2022-07-25 11:06:29 +01:00
scripting.asciidoc [DOCS] Add documentation for Painless field API (#83388) 2022-02-03 15:15:38 -05:00
search.asciidoc [DOCS] Add high-level guide for kNN search (#80857) 2021-11-30 14:17:39 -05:00
setup.asciidoc Documenting master_is_stable health API settings (#87901) 2022-07-26 12:02:38 -05:00
troubleshooting.asciidoc Add troubleshooting docs about data corruption (#88760) 2022-07-28 11:23:23 +01:00
upgrade.asciidoc Docs for snapshots as simple archives (#86261) 2022-05-30 13:23:53 +02:00