|
| 1 | +# Licensed to Elasticsearch B.V. under one or more contributor |
| 2 | +# license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright |
| 4 | +# ownership. Elasticsearch B.V. licenses this file to you under |
| 5 | +# the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +module Elasticsearch |
| 19 | + module XPack |
| 20 | + module API |
| 21 | + module IndexLifecycleManagement |
| 22 | + module Actions |
| 23 | + # Migrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing |
| 24 | + # |
| 25 | + # @option arguments [Boolean] :dry_run If set to true it will simulate the migration, providing a way to retrieve the ILM policies and indices that need to be migrated. The default is false |
| 26 | + # @option arguments [Hash] :headers Custom HTTP headers |
| 27 | + # @option arguments [Hash] :body Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data") |
| 28 | + # |
| 29 | + # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-migrate-to-data-tiers.html |
| 30 | + # |
| 31 | + def migrate_to_data_tiers(arguments = {}) |
| 32 | + headers = arguments.delete(:headers) || {} |
| 33 | + |
| 34 | + arguments = arguments.clone |
| 35 | + |
| 36 | + method = Elasticsearch::API::HTTP_POST |
| 37 | + path = "_ilm/migrate_to_data_tiers" |
| 38 | + params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) |
| 39 | + |
| 40 | + body = arguments[:body] |
| 41 | + perform_request(method, path, params, body, headers).body |
| 42 | + end |
| 43 | + |
| 44 | + # Register this action with its valid params when the module is loaded. |
| 45 | + # |
| 46 | + # @since 6.2.0 |
| 47 | + ParamsRegistry.register(:migrate_to_data_tiers, [ |
| 48 | + :dry_run |
| 49 | + ].freeze) |
| 50 | + end |
| 51 | + end |
| 52 | + end |
| 53 | + end |
| 54 | +end |
0 commit comments