elasticsearch-xpack 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/elasticsearch/xpack.rb +7 -1
- data/lib/elasticsearch/xpack/api/actions/data_frame/delete_data_frame_transform.rb +10 -2
- data/lib/elasticsearch/xpack/api/actions/data_frame/get_data_frame_transform.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/data_frame/get_data_frame_transform_stats.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/data_frame/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/data_frame/put_data_frame_transform.rb +10 -2
- data/lib/elasticsearch/xpack/api/actions/data_frame/start_data_frame_transform.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/data_frame/stop_data_frame_transform.rb +9 -6
- data/lib/elasticsearch/xpack/api/actions/data_frame/update_data_frame_transform.rb +45 -0
- data/lib/elasticsearch/xpack/api/actions/graph/explore.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/graph/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_policy.rb +39 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain.rb +40 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_policy.rb +38 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_status.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/move_to_step.rb +41 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_policy.rb +40 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/remove_policy.rb +38 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry_policy.rb +38 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/start.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/index_lifecycle_management/stop.rb +36 -0
- data/lib/elasticsearch/xpack/api/actions/info.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/license/get.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/license/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/license/post.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/license/post_start_basic.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/license/post_start_trial.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/close_job.rb +8 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_datafeed.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_forecast.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_job.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/machine_learning/estimate_memory_usage.rb +30 -0
- data/lib/elasticsearch/xpack/api/actions/machine_learning/flush_job.rb +10 -7
- data/lib/elasticsearch/xpack/api/actions/machine_learning/forecast.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_buckets.rb +15 -13
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_calendar_events.rb +11 -9
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_calendars.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_categories.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeed_stats.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeeds.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_filters.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_influencers.rb +13 -10
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_job_stats.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_jobs.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_model_snapshots.rb +11 -8
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_overall_buckets.rb +12 -11
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_records.rb +13 -12
- data/lib/elasticsearch/xpack/api/actions/machine_learning/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/machine_learning/post_data.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/revert_model_snapshot.rb +6 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/set_upgrade_mode.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/machine_learning/start_datafeed.rb +8 -7
- data/lib/elasticsearch/xpack/api/actions/machine_learning/stop_datafeed.rb +8 -5
- data/lib/elasticsearch/xpack/api/actions/migration/get_assistance.rb +8 -6
- data/lib/elasticsearch/xpack/api/actions/migration/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/migration/upgrade.rb +6 -5
- data/lib/elasticsearch/xpack/api/actions/monitoring/bulk.rb +9 -8
- data/lib/elasticsearch/xpack/api/actions/monitoring/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/params_registry.rb +48 -0
- data/lib/elasticsearch/xpack/api/actions/rollup/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/rollup/rollup_search.rb +7 -3
- data/lib/elasticsearch/xpack/api/actions/security/authenticate.rb +0 -1
- data/lib/elasticsearch/xpack/api/actions/security/change_password.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/clear_cached_realms.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/create_api_key.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/delete_privileges.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/security/delete_role.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/delete_role_mapping.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/security/delete_user.rb +7 -5
- data/lib/elasticsearch/xpack/api/actions/security/disable_user.rb +10 -6
- data/lib/elasticsearch/xpack/api/actions/security/enable_user.rb +10 -6
- data/lib/elasticsearch/xpack/api/actions/security/get_api_key.rb +9 -7
- data/lib/elasticsearch/xpack/api/actions/security/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/security/put_privileges.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/put_role.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/security/put_role_mapping.rb +10 -6
- data/lib/elasticsearch/xpack/api/actions/security/put_user.rb +6 -4
- data/lib/elasticsearch/xpack/api/actions/sql/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/sql/query.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/ssl/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/usage.rb +7 -2
- data/lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb +6 -5
- data/lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb +7 -4
- data/lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/watcher/params_registry.rb +50 -0
- data/lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb +10 -9
- data/lib/elasticsearch/xpack/api/actions/watcher/stats.rb +7 -2
- data/lib/elasticsearch/xpack/api/namespace/index_lifecycle_management.rb +22 -0
- data/lib/elasticsearch/xpack/version.rb +1 -1
- metadata +29 -3
|
@@ -25,22 +25,25 @@ module Elasticsearch
|
|
|
25
25
|
#
|
|
26
26
|
def get_influencers(arguments={})
|
|
27
27
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
|
28
|
-
valid_params = [
|
|
29
|
-
:exclude_interim,
|
|
30
|
-
:from,
|
|
31
|
-
:size,
|
|
32
|
-
:start,
|
|
33
|
-
:end,
|
|
34
|
-
:influencer_score,
|
|
35
|
-
:sort,
|
|
36
|
-
:desc ]
|
|
37
28
|
method = Elasticsearch::API::HTTP_GET
|
|
38
29
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/results/influencers"
|
|
39
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
30
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
40
31
|
body = arguments[:body]
|
|
41
32
|
|
|
42
33
|
perform_request(method, path, params, body).body
|
|
43
34
|
end
|
|
35
|
+
|
|
36
|
+
# Register this action with its valid params when the module is loaded.
|
|
37
|
+
#
|
|
38
|
+
# @since 7.4.0
|
|
39
|
+
ParamsRegistry.register(:get_influencers, [ :exclude_interim,
|
|
40
|
+
:from,
|
|
41
|
+
:size,
|
|
42
|
+
:start,
|
|
43
|
+
:end,
|
|
44
|
+
:influencer_score,
|
|
45
|
+
:sort,
|
|
46
|
+
:desc ].freeze)
|
|
44
47
|
end
|
|
45
48
|
end
|
|
46
49
|
end
|
|
@@ -16,16 +16,18 @@ module Elasticsearch
|
|
|
16
16
|
# @see http://www.elastic.co/guide/en/x-pack/current/ml-get-job-stats.html
|
|
17
17
|
#
|
|
18
18
|
def get_job_stats(arguments={})
|
|
19
|
-
valid_params = [
|
|
20
|
-
:allow_no_jobs ]
|
|
21
|
-
|
|
22
19
|
method = Elasticsearch::API::HTTP_GET
|
|
23
20
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/_stats"
|
|
24
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
21
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
25
22
|
body = nil
|
|
26
23
|
|
|
27
24
|
perform_request(method, path, params, body).body
|
|
28
25
|
end
|
|
26
|
+
|
|
27
|
+
# Register this action with its valid params when the module is loaded.
|
|
28
|
+
#
|
|
29
|
+
# @since 7.4.0
|
|
30
|
+
ParamsRegistry.register(:get_job_stats, [ :allow_no_jobs ].freeze)
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
|
@@ -16,16 +16,18 @@ module Elasticsearch
|
|
|
16
16
|
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html
|
|
17
17
|
#
|
|
18
18
|
def get_jobs(arguments={})
|
|
19
|
-
valid_params = [
|
|
20
|
-
:allow_no_jobs ]
|
|
21
|
-
|
|
22
19
|
method = Elasticsearch::API::HTTP_GET
|
|
23
20
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}"
|
|
24
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
21
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
25
22
|
body = nil
|
|
26
23
|
|
|
27
24
|
perform_request(method, path, params, body).body
|
|
28
25
|
end
|
|
26
|
+
|
|
27
|
+
# Register this action with its valid params when the module is loaded.
|
|
28
|
+
#
|
|
29
|
+
# @since 7.4.0
|
|
30
|
+
ParamsRegistry.register(:get_jobs, [ :allow_no_jobs ].freeze)
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
|
@@ -24,20 +24,23 @@ module Elasticsearch
|
|
|
24
24
|
#
|
|
25
25
|
def get_model_snapshots(arguments={})
|
|
26
26
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
|
27
|
-
valid_params = [
|
|
28
|
-
:from,
|
|
29
|
-
:size,
|
|
30
|
-
:start,
|
|
31
|
-
:end,
|
|
32
|
-
:sort,
|
|
33
|
-
:desc ]
|
|
34
27
|
method = Elasticsearch::API::HTTP_GET
|
|
35
28
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/model_snapshots/#{arguments[:snapshot_id]}"
|
|
36
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
29
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
37
30
|
body = arguments[:body]
|
|
38
31
|
|
|
39
32
|
perform_request(method, path, params, body).body
|
|
40
33
|
end
|
|
34
|
+
|
|
35
|
+
# Register this action with its valid params when the module is loaded.
|
|
36
|
+
#
|
|
37
|
+
# @since 7.4.0
|
|
38
|
+
ParamsRegistry.register(:get_model_snapshots, [ :from,
|
|
39
|
+
:size,
|
|
40
|
+
:start,
|
|
41
|
+
:end,
|
|
42
|
+
:sort,
|
|
43
|
+
:desc ].freeze)
|
|
41
44
|
end
|
|
42
45
|
end
|
|
43
46
|
end
|
|
@@ -24,23 +24,24 @@ module Elasticsearch
|
|
|
24
24
|
#
|
|
25
25
|
def get_overall_buckets(arguments={})
|
|
26
26
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
|
27
|
-
|
|
28
|
-
valid_params = [
|
|
29
|
-
:top_n,
|
|
30
|
-
:bucket_span,
|
|
31
|
-
:overall_score,
|
|
32
|
-
:exclude_interim,
|
|
33
|
-
:start,
|
|
34
|
-
:end,
|
|
35
|
-
:allow_no_jobs ]
|
|
36
|
-
|
|
37
27
|
method = Elasticsearch::API::HTTP_GET
|
|
38
28
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/results/overall_buckets"
|
|
39
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
29
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
40
30
|
body = arguments[:body]
|
|
41
31
|
|
|
42
32
|
perform_request(method, path, params, body).body
|
|
43
33
|
end
|
|
34
|
+
|
|
35
|
+
# Register this action with its valid params when the module is loaded.
|
|
36
|
+
#
|
|
37
|
+
# @since 7.4.0
|
|
38
|
+
ParamsRegistry.register(:get_overall_buckets, [ :top_n,
|
|
39
|
+
:bucket_span,
|
|
40
|
+
:overall_score,
|
|
41
|
+
:exclude_interim,
|
|
42
|
+
:start,
|
|
43
|
+
:end,
|
|
44
|
+
:allow_no_jobs ].freeze)
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
end
|
|
@@ -25,24 +25,25 @@ module Elasticsearch
|
|
|
25
25
|
#
|
|
26
26
|
def get_records(arguments={})
|
|
27
27
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
|
28
|
-
|
|
29
|
-
valid_params = [
|
|
30
|
-
:exclude_interim,
|
|
31
|
-
:from,
|
|
32
|
-
:size,
|
|
33
|
-
:start,
|
|
34
|
-
:end,
|
|
35
|
-
:record_score,
|
|
36
|
-
:sort,
|
|
37
|
-
:desc ]
|
|
38
|
-
|
|
39
28
|
method = Elasticsearch::API::HTTP_GET
|
|
40
29
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/results/records"
|
|
41
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
30
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
42
31
|
body = arguments[:body]
|
|
43
32
|
|
|
44
33
|
perform_request(method, path, params, body).body
|
|
45
34
|
end
|
|
35
|
+
|
|
36
|
+
# Register this action with its valid params when the module is loaded.
|
|
37
|
+
#
|
|
38
|
+
# @since 7.4.0
|
|
39
|
+
ParamsRegistry.register(:get_records, [ :exclude_interim,
|
|
40
|
+
:from,
|
|
41
|
+
:size,
|
|
42
|
+
:start,
|
|
43
|
+
:end,
|
|
44
|
+
:record_score,
|
|
45
|
+
:sort,
|
|
46
|
+
:desc ].freeze)
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
49
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
# See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
module Elasticsearch
|
|
6
|
+
module XPack
|
|
7
|
+
module API
|
|
8
|
+
module MachineLearning
|
|
9
|
+
module Actions
|
|
10
|
+
module ParamsRegistry
|
|
11
|
+
|
|
12
|
+
extend self
|
|
13
|
+
|
|
14
|
+
# A Mapping of all the actions to their list of valid params.
|
|
15
|
+
#
|
|
16
|
+
# @since 7.4.0
|
|
17
|
+
PARAMS = {}
|
|
18
|
+
|
|
19
|
+
# Register an action with its list of valid params.
|
|
20
|
+
#
|
|
21
|
+
# @example Register the action.
|
|
22
|
+
# ParamsRegistry.register(:benchmark, [ :verbose ])
|
|
23
|
+
#
|
|
24
|
+
# @param [ Symbol ] action The action to register.
|
|
25
|
+
# @param [ Array[Symbol] ] valid_params The list of valid params.
|
|
26
|
+
#
|
|
27
|
+
# @since 7.4.0
|
|
28
|
+
def register(action, valid_params)
|
|
29
|
+
PARAMS[action.to_sym] = valid_params
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get the list of valid params for a given action.
|
|
33
|
+
#
|
|
34
|
+
# @example Get the list of valid params.
|
|
35
|
+
# ParamsRegistry.get(:benchmark)
|
|
36
|
+
#
|
|
37
|
+
# @param [ Symbol ] action The action.
|
|
38
|
+
#
|
|
39
|
+
# @return [ Array<Symbol> ] The list of valid params for the action.
|
|
40
|
+
#
|
|
41
|
+
# @since 7.4.0
|
|
42
|
+
def get(action)
|
|
43
|
+
PARAMS.fetch(action, [])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -20,16 +20,19 @@ module Elasticsearch
|
|
|
20
20
|
def post_data(arguments={})
|
|
21
21
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
|
22
22
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
23
|
-
valid_params = [
|
|
24
|
-
:reset_start,
|
|
25
|
-
:reset_end ]
|
|
26
23
|
method = Elasticsearch::API::HTTP_POST
|
|
27
24
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/_data"
|
|
28
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
25
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
29
26
|
body = arguments[:body]
|
|
30
27
|
|
|
31
28
|
perform_request(method, path, params, body).body
|
|
32
29
|
end
|
|
30
|
+
|
|
31
|
+
# Register this action with its valid params when the module is loaded.
|
|
32
|
+
#
|
|
33
|
+
# @since 7.4.0
|
|
34
|
+
ParamsRegistry.register(:post_data, [ :reset_start,
|
|
35
|
+
:reset_end ].freeze)
|
|
33
36
|
end
|
|
34
37
|
end
|
|
35
38
|
end
|
|
@@ -19,17 +19,18 @@ module Elasticsearch
|
|
|
19
19
|
#
|
|
20
20
|
def revert_model_snapshot(arguments={})
|
|
21
21
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
|
22
|
-
|
|
23
|
-
valid_params = [
|
|
24
|
-
:delete_intervening_results ]
|
|
25
|
-
|
|
26
22
|
method = Elasticsearch::API::HTTP_POST
|
|
27
23
|
path = Elasticsearch::API::Utils.__pathify "_xpack/ml/anomaly_detectors", arguments[:job_id], "model_snapshots", arguments[:snapshot_id], "_revert"
|
|
28
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
24
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
29
25
|
body = arguments[:body]
|
|
30
26
|
|
|
31
27
|
perform_request(method, path, params, body).body
|
|
32
28
|
end
|
|
29
|
+
|
|
30
|
+
# Register this action with its valid params when the module is loaded.
|
|
31
|
+
#
|
|
32
|
+
# @since 7.4.0
|
|
33
|
+
ParamsRegistry.register(:revert_model_snapshot, [ :delete_intervening_results ].freeze)
|
|
33
34
|
end
|
|
34
35
|
end
|
|
35
36
|
end
|
|
@@ -18,17 +18,19 @@ module Elasticsearch
|
|
|
18
18
|
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html
|
|
19
19
|
#
|
|
20
20
|
def set_upgrade_mode(arguments={})
|
|
21
|
-
|
|
22
|
-
valid_params = [
|
|
23
|
-
:enabled,
|
|
24
|
-
:timeout ]
|
|
25
|
-
|
|
26
21
|
method = Elasticsearch::API::HTTP_POST
|
|
27
22
|
path = '_ml/set_upgrade_mode'
|
|
28
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
23
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
29
24
|
|
|
30
25
|
perform_request(method, path, params).body
|
|
31
26
|
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Register this action with its valid params when the module is loaded.
|
|
30
|
+
#
|
|
31
|
+
# @since 7.4.0
|
|
32
|
+
ParamsRegistry.register(:set_upgrade_mode, [ :enabled,
|
|
33
|
+
:timeout ].freeze)
|
|
32
34
|
end
|
|
33
35
|
end
|
|
34
36
|
end
|
|
@@ -20,19 +20,20 @@ module Elasticsearch
|
|
|
20
20
|
#
|
|
21
21
|
def start_datafeed(arguments={})
|
|
22
22
|
raise ArgumentError, "Required argument 'datafeed_id' missing" unless arguments[:datafeed_id]
|
|
23
|
-
|
|
24
|
-
valid_params = [
|
|
25
|
-
:start,
|
|
26
|
-
:end,
|
|
27
|
-
:timeout ]
|
|
28
|
-
|
|
29
23
|
method = Elasticsearch::API::HTTP_POST
|
|
30
24
|
path = "_xpack/ml/datafeeds/#{arguments[:datafeed_id]}/_start"
|
|
31
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
25
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
32
26
|
body = arguments[:body]
|
|
33
27
|
|
|
34
28
|
perform_request(method, path, params, body).body
|
|
35
29
|
end
|
|
30
|
+
|
|
31
|
+
# Register this action with its valid params when the module is loaded.
|
|
32
|
+
#
|
|
33
|
+
# @since 7.4.0
|
|
34
|
+
ParamsRegistry.register(:start_datafeed, [ :start,
|
|
35
|
+
:end,
|
|
36
|
+
:timeout ].freeze)
|
|
36
37
|
end
|
|
37
38
|
end
|
|
38
39
|
end
|
|
@@ -19,17 +19,20 @@ module Elasticsearch
|
|
|
19
19
|
#
|
|
20
20
|
def stop_datafeed(arguments={})
|
|
21
21
|
raise ArgumentError, "Required argument 'datafeed_id' missing" unless arguments[:datafeed_id]
|
|
22
|
-
valid_params = [
|
|
23
|
-
:allow_no_datafeeds,
|
|
24
|
-
:force,
|
|
25
|
-
:timeout ]
|
|
26
22
|
method = Elasticsearch::API::HTTP_POST
|
|
27
23
|
path = "_xpack/ml/datafeeds/#{arguments[:datafeed_id]}/_stop"
|
|
28
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
24
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
29
25
|
body = nil
|
|
30
26
|
|
|
31
27
|
perform_request(method, path, params, body).body
|
|
32
28
|
end
|
|
29
|
+
|
|
30
|
+
# Register this action with its valid params when the module is loaded.
|
|
31
|
+
#
|
|
32
|
+
# @since 7.4.0
|
|
33
|
+
ParamsRegistry.register(:stop_datafeed, [ :allow_no_datafeeds,
|
|
34
|
+
:force,
|
|
35
|
+
:timeout ].freeze)
|
|
33
36
|
end
|
|
34
37
|
end
|
|
35
38
|
end
|
|
@@ -18,18 +18,20 @@ module Elasticsearch
|
|
|
18
18
|
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html
|
|
19
19
|
#
|
|
20
20
|
def get_assistance(arguments={})
|
|
21
|
-
valid_params = [
|
|
22
|
-
:allow_no_indices,
|
|
23
|
-
:expand_wildcards,
|
|
24
|
-
:ignore_unavailable ]
|
|
25
|
-
|
|
26
21
|
method = Elasticsearch::API::HTTP_GET
|
|
27
22
|
path = "_xpack/migration/assistance"
|
|
28
|
-
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
23
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
29
24
|
body = nil
|
|
30
25
|
|
|
31
26
|
perform_request(method, path, params, body).body
|
|
32
27
|
end
|
|
28
|
+
|
|
29
|
+
# Register this action with its valid params when the module is loaded.
|
|
30
|
+
#
|
|
31
|
+
# @since 7.4.0
|
|
32
|
+
ParamsRegistry.register(:get_assistance, [ :allow_no_indices,
|
|
33
|
+
:expand_wildcards,
|
|
34
|
+
:ignore_unavailable ].freeze)
|
|
33
35
|
end
|
|
34
36
|
end
|
|
35
37
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
|
3
|
+
# See the LICENSE file in the project root for more information
|
|
4
|
+
|
|
5
|
+
module Elasticsearch
|
|
6
|
+
module XPack
|
|
7
|
+
module API
|
|
8
|
+
module Migration
|
|
9
|
+
module Actions
|
|
10
|
+
module ParamsRegistry
|
|
11
|
+
|
|
12
|
+
extend self
|
|
13
|
+
|
|
14
|
+
# A Mapping of all the actions to their list of valid params.
|
|
15
|
+
#
|
|
16
|
+
# @since 7.4.0
|
|
17
|
+
PARAMS = {}
|
|
18
|
+
|
|
19
|
+
# Register an action with its list of valid params.
|
|
20
|
+
#
|
|
21
|
+
# @example Register the action.
|
|
22
|
+
# ParamsRegistry.register(:benchmark, [ :verbose ])
|
|
23
|
+
#
|
|
24
|
+
# @param [ Symbol ] action The action to register.
|
|
25
|
+
# @param [ Array[Symbol] ] valid_params The list of valid params.
|
|
26
|
+
#
|
|
27
|
+
# @since 7.4.0
|
|
28
|
+
def register(action, valid_params)
|
|
29
|
+
PARAMS[action.to_sym] = valid_params
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get the list of valid params for a given action.
|
|
33
|
+
#
|
|
34
|
+
# @example Get the list of valid params.
|
|
35
|
+
# ParamsRegistry.get(:benchmark)
|
|
36
|
+
#
|
|
37
|
+
# @param [ Symbol ] action The action.
|
|
38
|
+
#
|
|
39
|
+
# @return [ Array<Symbol> ] The list of valid params for the action.
|
|
40
|
+
#
|
|
41
|
+
# @since 7.4.0
|
|
42
|
+
def get(action)
|
|
43
|
+
PARAMS.fetch(action, [])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|