-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
778 additions
and
153 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
specification/_global/reindex/examples/request/ReindexRequestExample1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
summary: Reindex multiple sources | ||
# method_request: POST _reindex | ||
description: > | ||
Run `POST _reindex` to reindex from multiple sources. | ||
The `index` attribute in source can be a list, which enables you to copy from lots of sources in one request. | ||
This example copies documents from the `my-index-000001` and `my-index-000002` indices. | ||
# type: request | ||
value: |- | ||
{ | ||
"source": { | ||
"index": ["my-index-000001", "my-index-000002"] | ||
}, | ||
"dest": { | ||
"index": "my-new-index-000002" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
specification/_global/reindex/examples/request/ReindexRequestExample10.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
summary: Reindex with Painless | ||
# method_request: POST _reindex | ||
description: > | ||
You can use Painless to reindex daily indices to apply a new template to the existing documents. | ||
The script extracts the date from the index name and creates a new index with `-1` appended. | ||
For example, all data from `metricbeat-2016.05.31` will be reindexed into `metricbeat-2016.05.31-1`. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"metricbeat-*\"\n },\n \"dest\": {\n\ | ||
\ \"index\": \"metricbeat\"\n },\n \"script\": {\n \"lang\": \"painless\"\ | ||
,\n \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(),\ | ||
\ ctx._index.length())) + '-1'\"\n }\n}" |
11 changes: 11 additions & 0 deletions
11
specification/_global/reindex/examples/request/ReindexRequestExample11.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Reindex a random subset | ||
# method_request: POST _reindex | ||
description: > | ||
Run `POST _reindex` to extract a random subset of the source for testing. | ||
You might need to adjust the `min_score` value depending on the relative amount of data extracted from source. | ||
# type: request | ||
value: | ||
"{\n \"max_docs\": 10,\n \"source\": {\n \"index\": \"my-index-000001\"\ | ||
,\n \"query\": {\n \"function_score\" : {\n \"random_score\" : {},\n\ | ||
\ \"min_score\" : 0.9\n }\n }\n },\n \"dest\": {\n \"index\"\ | ||
: \"my-new-index-000001\"\n }\n}" |
11 changes: 11 additions & 0 deletions
11
specification/_global/reindex/examples/request/ReindexRequestExample12.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Reindex modified documents | ||
# method_request: POST _reindex | ||
description: > | ||
Run `POST _reindex` to modify documents during reindexing. | ||
This example bumps the version of the source document. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\":\ | ||
\ {\n \"index\": \"my-new-index-000001\",\n \"version_type\": \"external\"\ | ||
\n },\n \"script\": {\n \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++;\ | ||
\ ctx._source.remove('foo')}\",\n \"lang\": \"painless\"\n }\n}" |
11 changes: 11 additions & 0 deletions
11
specification/_global/reindex/examples/request/ReindexRequestExample13.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Reindex from remote on Elastic Cloud | ||
# method_request: POST _reindex | ||
description: > | ||
When using Elastic Cloud, you can run `POST _reindex` and authenticate against a remote cluster with an API key. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"remote\": {\n \"host\": \"http://otherhost:9200\"\ | ||
,\n \"username\": \"user\",\n \"password\": \"pass\"\n },\n \"index\"\ | ||
: \"my-index-000001\",\n \"query\": {\n \"match\": {\n \"test\":\ | ||
\ \"data\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\ | ||
\n }\n}" |
19 changes: 19 additions & 0 deletions
19
specification/_global/reindex/examples/request/ReindexRequestExample2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
summary: Manual slicing | ||
# method_request: POST _reindex | ||
description: > | ||
Run `POST _reindex` to slice a reindex request manually. | ||
Provide a slice ID and total number of slices to each request. | ||
# type: request | ||
value: |- | ||
{ | ||
"source": { | ||
"index": "my-index-000001", | ||
"slice": { | ||
"id": 0, | ||
"max": 2 | ||
} | ||
}, | ||
"dest": { | ||
"index": "my-new-index-000001" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
specification/_global/reindex/examples/request/ReindexRequestExample3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
summary: Automatic slicing | ||
# method_request: POST _reindex?slices=5&refresh | ||
description: > | ||
Run `POST _reindex?slices=5&refresh` to automatically parallelize using sliced scroll to slice on `_id`. | ||
The `slices` parameter specifies the number of slices to use. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\":\ | ||
\ {\n \"index\": \"my-new-index-000001\"\n }\n}" |
11 changes: 11 additions & 0 deletions
11
specification/_global/reindex/examples/request/ReindexRequestExample4.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Routing | ||
# method_request: POST _reindex | ||
description: > | ||
By default if reindex sees a document with routing then the routing is preserved unless it's changed by the script. | ||
You can set `routing` on the `dest` request to change this behavior. | ||
In this example, run `POST _reindex` to copy all documents from the `source` with the company name `cat` into the `dest` with routing set to `cat`. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"source\",\n \"query\": {\n \"\ | ||
match\": {\n \"company\": \"cat\"\n }\n }\n },\n \"dest\": {\n\ | ||
\ \"index\": \"dest\",\n \"routing\": \"=cat\"\n }\n}" |
7 changes: 7 additions & 0 deletions
7
specification/_global/reindex/examples/request/ReindexRequestExample5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
summary: Ingest pipelines | ||
# method_request: POST _reindex | ||
description: Run `POST _reindex` and use the ingest pipelines feature. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"source\"\n },\n \"dest\": {\n \"\ | ||
index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n }\n}" |
10 changes: 10 additions & 0 deletions
10
specification/_global/reindex/examples/request/ReindexRequestExample6.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
summary: Reindex with a query | ||
# method_request: POST _reindex | ||
description: > | ||
Run `POST _reindex` and add a query to the `source` to limit the documents to reindex. | ||
For example, this request copies documents into `my-new-index-000001` only if they have a `user.id` of `kimchy`. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n\ | ||
\ \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n },\n \"\ | ||
dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" |
9 changes: 9 additions & 0 deletions
9
specification/_global/reindex/examples/request/ReindexRequestExample7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
summary: Reindex with max_docs | ||
# method_request: POST _reindex | ||
description: > | ||
You can limit the number of processed documents by setting `max_docs`. | ||
For example, run `POST _reindex` to copy a single document from `my-index-000001` to `my-new-index-000001`. | ||
# type: request | ||
value: | ||
"{\n \"max_docs\": 1,\n \"source\": {\n \"index\": \"my-index-000001\"\ | ||
\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" |
10 changes: 10 additions & 0 deletions
10
specification/_global/reindex/examples/request/ReindexRequestExample8.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
summary: Reindex selected fields | ||
# method_request: POST _reindex | ||
description: > | ||
You can use source filtering to reindex a subset of the fields in the original documents. | ||
For example, run `POST _reindex` the reindex only the `user.id` and `_doc` fields of each document. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"_source\":\ | ||
\ [\"user.id\", \"_doc\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\ | ||
\n }\n}" |
10 changes: 10 additions & 0 deletions
10
specification/_global/reindex/examples/request/ReindexRequestExample9.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
summary: Reindex new field names | ||
# method_request: POST _reindex | ||
description: > | ||
A reindex operation can build a copy of an index with renamed fields. | ||
If your index has documents with `text` and `flag` fields, you can change the latter field name to `tag` during the reindex. | ||
# type: request | ||
value: | ||
"{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\":\ | ||
\ {\n \"index\": \"my-new-index-000001\"\n },\n \"script\": {\n \"source\"\ | ||
: \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\"\n }\n}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.