1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
|
---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/curator/current/option_request_body.html
---
# request_body [option_request_body]
::::{note}
This setting is only used by the [reindex](/reference/reindex.md) action.
::::
## Manual index selection [_manual_index_selection]
The `request_body` option is the heart of the reindex action. In here, using YAML syntax, you recreate the body sent to Elasticsearch as described in [the official documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-reindex). You can manually select indices as with this example:
```yaml
actions:
1:
description: "Reindex index1 into index2"
action: reindex
options:
wait_interval: 9
max_wait: -1
request_body:
source:
index: index1
dest:
index: index2
filters:
- filtertype: none
```
You can also select multiple indices to reindex by making a list in acceptable YAML syntax:
```yaml
actions:
1:
description: "Reindex index1,index2,index3 into new_index"
action: reindex
options:
wait_interval: 9
max_wait: -1
request_body:
source:
index: ['index1', 'index2', 'index3']
dest:
index: new_index
filters:
- filtertype: none
```
::::{important}
You *must* set at least a [none](/reference/filtertype_none.md) filter, or the action will fail. Do not worry. If you’ve manually specified your indices, those are the only ones which will be reindexed.
::::
## Filter-Selected Indices [_filter_selected_indices]
Curator allows you to use all indices found by the `filters` section by setting the `source` index to `REINDEX_SELECTION`, like this:
```yaml
actions:
1:
description: >-
Reindex all daily logstash indices from March 2017 into logstash-2017.03
action: reindex
options:
wait_interval: 9
max_wait: -1
request_body:
source:
index: REINDEX_SELECTION
dest:
index: logstash-2017.03
filters:
- filtertype: pattern
kind: prefix
value: logstash-2017.03.
```
## Reindex From Remote [_reindex_from_remote]
You can also reindex from remote:
```yaml
actions:
1:
description: "Reindex remote index1 to local index1"
action: reindex
options:
wait_interval: 9
max_wait: -1
request_body:
source:
remote:
host: http://otherhost:9200
username: myuser
password: mypass
index: index1
dest:
index: index1
filters:
- filtertype: none
```
::::{important}
You *must* set at least a [none](/reference/filtertype_none.md) filter, or the action will fail. Do not worry. Only the indices you specified in `source` will be reindexed.
::::
Curator will create a connection to the host specified as the `host` key in the above example. It will determine which port to connect to, and whether to use SSL by parsing the URL entered there. Because this `host` is specifically used by Elasticsearch, and Curator is making a separate connection, it is important to ensure that both Curator *and* your Elasticsearch cluster have access to the remote host.
If you do not whitelist the remote cluster, you will not be able to reindex. This can be done by adding the following line to your `elasticsearch.yml` file:
```yaml
reindex.remote.whitelist: remote_host_or_IP1:9200, remote_host_or_IP2:9200
```
or by adding this flag to the command-line when starting Elasticsearch:
```sh
bin/elasticsearch -Edefault.reindex.remote.whitelist="remote_host_or_IP:9200"
```
Of course, be sure to substitute the correct host, IP, or port.
Other client connection arguments can also be supplied in the form of action options:
* [remote_url_prefix](/reference/option_remote_url_prefix.md)
* [remote_certificate](/reference/option_remote_certificate.md)
* [remote_client_cert](/reference/option_remote_client_cert.md)
* [remote_client_key](/reference/option_remote_client_key.md)
## Reindex From Remote With Filter-Selected Indices [_reindex_from_remote_with_filter_selected_indices]
You can even reindex from remote with filter-selected indices on the remote side:
```yaml
actions:
1:
description: >-
Reindex all remote daily logstash indices from March 2017 into local index
logstash-2017.03
action: reindex
options:
wait_interval: 9
max_wait: -1
request_body:
source:
remote:
host: http://otherhost:9200
username: myuser
password: mypass
index: REINDEX_SELECTION
dest:
index: logstash-2017.03
remote_filters:
- filtertype: pattern
kind: prefix
value: logstash-2017.03.
filters:
- filtertype: none
```
::::{important}
Even though you are reindexing from remote, you *must* set at least a [none](/reference/filtertype_none.md) filter, or the action will fail. Do not worry. Only the indices specified in `source` will be reindexed.
::::
Curator will create a connection to the host specified as the `host` key in the above example. It will determine which port to connect to, and whether to use SSL by parsing the URL entered there. Because this `host` is specifically used by Elasticsearch, and Curator is making a separate connection, it is important to ensure that both Curator *and* your Elasticsearch cluster have access to the remote host.
If you do not whitelist the remote cluster, you will not be able to reindex. This can be done by adding the following line to your `elasticsearch.yml` file:
```yaml
reindex.remote.whitelist: remote_host_or_IP1:9200, remote_host_or_IP2:9200
```
or by adding this flag to the command-line when starting Elasticsearch:
```sh
bin/elasticsearch -Edefault.reindex.remote.whitelist="remote_host_or_IP:9200"
```
Of course, be sure to substitute the correct host, IP, or port.
Other client connection arguments can also be supplied in the form of action options:
* [remote_url_prefix](/reference/option_remote_url_prefix.md)
* [remote_certificate](/reference/option_remote_certificate.md)
* [remote_client_cert](/reference/option_remote_client_cert.md)
* [remote_client_key](/reference/option_remote_client_key.md)
## Reindex - Migration [_reindex_migration]
Curator allows reindexing, particularly from remote, as a migration path. This can be a very useful feature for migrating an older cluster (1.4+) to a new cluster, on different hardware. It can also be a useful tool for serially reindexing indices into newer mappings in an automatable way.
Ordinarily, a reindex operation is from either one, or many indices, to a single, named index. Assigning the `dest` `index` to `MIGRATION` tells Curator to treat this reindex differently.
::::{important}
**If it is a *local* reindex,** you *must* set either [migration_prefix](/reference/option_migration_prefix.md), or [migration_suffix](/reference/option_migration_suffix.md), or both. This prevents collisions and other bad things from happening. By assigning a prefix or a suffix (or both), you can reindex any local indices to new versions of themselves, but named differently.
It is true the Reindex API already has this functionality. Curator includes this same functionality for convenience.
::::
This example will reindex all of the remote indices matching `logstash-2017.03.` into the local cluster, but preserve the original index names, rather than merge all of the contents into a single index. Internal to Curator, this results in multiple reindex actions: one per index. All other available options and settings are available.
```yaml
actions:
1:
description: >-
Reindex all remote daily logstash indices from March 2017 into local
versions with the same index names.
action: reindex
options:
wait_interval: 9
max_wait: -1
request_body:
source:
remote:
host: http://otherhost:9200
username: myuser
password: mypass
index: REINDEX_SELECTION
dest:
index: MIGRATION
remote_filters:
- filtertype: pattern
kind: prefix
value: logstash-2017.03.
filters:
- filtertype: none
```
::::{important}
Even though you are reindexing from remote, you *must* set at least a [none](/reference/filtertype_none.md) filter, or the action will fail. Do not worry. Only the indices specified in `source` will be reindexed.
::::
Curator will create a connection to the host specified as the `host` key in the above example. It will determine which port to connect to, and whether to use SSL by parsing the URL entered there. Because this `host` is specifically used by Elasticsearch, and Curator is making a separate connection, it is important to ensure that both Curator *and* your Elasticsearch cluster have access to the remote host.
If you do not whitelist the remote cluster, you will not be able to reindex. This can be done by adding the following line to your `elasticsearch.yml` file:
```yaml
reindex.remote.whitelist: remote_host_or_IP1:9200, remote_host_or_IP2:9200
```
or by adding this flag to the command-line when starting Elasticsearch:
```sh
bin/elasticsearch -Edefault.reindex.remote.whitelist="remote_host_or_IP:9200"
```
Of course, be sure to substitute the correct host, IP, or port.
Other client connection arguments can also be supplied in the form of action options:
* [remote_url_prefix](/reference/option_remote_url_prefix.md)
* [remote_certificate](/reference/option_remote_certificate.md)
* [remote_client_cert](/reference/option_remote_client_cert.md)
* [remote_client_key](/reference/option_remote_client_key.md)
* [migration_prefix](/reference/option_migration_prefix.md)
* [migration_suffix](/reference/option_migration_suffix.md)
## Other scenarios and options [_other_scenarios_and_options]
Nearly all scenarios supported by the reindex API are supported in the request_body, including (but not limited to):
* Pipelines
* Scripting
* Queries
* Conflict resolution
* Limiting by count
* Versioning
* Reindexing operation type (for example, create-only)
Read more about these, and more, at [http://www.elastic.co/guide/en/elasticsearch/reference/8.15/docs-reindex.html](http://www.elastic.co/guide/en/elasticsearch/reference/8.15/docs-reindex.html)
Notable exceptions include:
* You cannot manually specify slices. Instead, use the [slices](/reference/option_slices.md) option for automated sliced reindexing.
|