elasticsearch-api 7.4.0 → 7.5.0.pre.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +16 -23
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -2
- data/lib/elasticsearch/api/actions/benchmark.rb +2 -3
- data/lib/elasticsearch/api/actions/bulk.rb +35 -68
- data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -52
- data/lib/elasticsearch/api/actions/cat/allocation.rb +36 -50
- data/lib/elasticsearch/api/actions/cat/count.rb +25 -46
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +31 -33
- data/lib/elasticsearch/api/actions/cat/health.rb +27 -37
- data/lib/elasticsearch/api/actions/cat/help.rb +14 -10
- data/lib/elasticsearch/api/actions/cat/indices.rb +45 -62
- data/lib/elasticsearch/api/actions/cat/master.rb +24 -34
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +20 -16
- data/lib/elasticsearch/api/actions/cat/nodes.rb +34 -46
- data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +29 -35
- data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -18
- data/lib/elasticsearch/api/actions/cat/recovery.rb +40 -56
- data/lib/elasticsearch/api/actions/cat/repositories.rb +21 -24
- data/lib/elasticsearch/api/actions/cat/segments.rb +29 -22
- data/lib/elasticsearch/api/actions/cat/shards.rb +38 -59
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +32 -27
- data/lib/elasticsearch/api/actions/cat/tasks.rb +25 -19
- data/lib/elasticsearch/api/actions/cat/templates.rb +26 -18
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +36 -46
- data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -8
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +15 -13
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +18 -18
- data/lib/elasticsearch/api/actions/cluster/health.rb +42 -44
- data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +15 -17
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +20 -17
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +8 -6
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +25 -37
- data/lib/elasticsearch/api/actions/cluster/state.rb +37 -41
- data/lib/elasticsearch/api/actions/cluster/stats.rb +20 -12
- data/lib/elasticsearch/api/actions/count.rb +52 -39
- data/lib/elasticsearch/api/actions/create.rb +25 -26
- data/lib/elasticsearch/api/actions/delete.rb +43 -36
- data/lib/elasticsearch/api/actions/delete_by_query.rb +74 -62
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +39 -0
- data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +4 -3
- data/lib/elasticsearch/api/actions/delete_script.rb +19 -13
- data/lib/elasticsearch/api/actions/exists.rb +44 -34
- data/lib/elasticsearch/api/actions/exists_source.rb +43 -25
- data/lib/elasticsearch/api/actions/explain.rb +46 -51
- data/lib/elasticsearch/api/actions/field_caps.rb +27 -20
- data/lib/elasticsearch/api/actions/get.rb +42 -41
- data/lib/elasticsearch/api/actions/get_script.rb +19 -14
- data/lib/elasticsearch/api/actions/get_source.rb +38 -44
- data/lib/elasticsearch/api/actions/index.rb +60 -89
- data/lib/elasticsearch/api/actions/indices/analyze.rb +19 -48
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +29 -41
- data/lib/elasticsearch/api/actions/indices/clone.rb +21 -21
- data/lib/elasticsearch/api/actions/indices/close.rb +28 -32
- data/lib/elasticsearch/api/actions/indices/create.rb +22 -70
- data/lib/elasticsearch/api/actions/indices/delete.rb +23 -35
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +24 -20
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -20
- data/lib/elasticsearch/api/actions/indices/exists.rb +32 -34
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +33 -29
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +21 -16
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +29 -29
- data/lib/elasticsearch/api/actions/indices/flush.rb +28 -28
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +23 -12
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +26 -41
- data/lib/elasticsearch/api/actions/indices/freeze.rb +7 -8
- data/lib/elasticsearch/api/actions/indices/get.rb +25 -19
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -23
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -38
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +39 -31
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +34 -37
- data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -23
- data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +48 -0
- data/lib/elasticsearch/api/actions/indices/open.rb +24 -21
- data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +25 -27
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +40 -39
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +30 -37
- data/lib/elasticsearch/api/actions/indices/put_template.rb +23 -23
- data/lib/elasticsearch/api/actions/indices/recovery.rb +20 -23
- data/lib/elasticsearch/api/actions/indices/refresh.rb +22 -26
- data/lib/elasticsearch/api/actions/indices/rollover.rb +28 -19
- data/lib/elasticsearch/api/actions/indices/segments.rb +24 -17
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -15
- data/lib/elasticsearch/api/actions/indices/shrink.rb +23 -17
- data/lib/elasticsearch/api/actions/indices/split.rb +23 -17
- data/lib/elasticsearch/api/actions/indices/stats.rb +53 -104
- data/lib/elasticsearch/api/actions/indices/unfreeze.rb +7 -7
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +15 -32
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +26 -16
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -59
- data/lib/elasticsearch/api/actions/info.rb +9 -6
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -12
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +21 -11
- data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +12 -13
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +19 -14
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -13
- data/lib/elasticsearch/api/actions/mget.rb +37 -44
- data/lib/elasticsearch/api/actions/msearch.rb +54 -54
- data/lib/elasticsearch/api/actions/msearch_template.rb +46 -35
- data/lib/elasticsearch/api/actions/mtermvectors.rb +39 -35
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +30 -25
- data/lib/elasticsearch/api/actions/nodes/info.rb +29 -63
- data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +24 -22
- data/lib/elasticsearch/api/actions/nodes/shutdown.rb +4 -4
- data/lib/elasticsearch/api/actions/nodes/stats.rb +43 -36
- data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -10
- data/lib/elasticsearch/api/actions/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/ping.rb +12 -13
- data/lib/elasticsearch/api/actions/put_script.rb +26 -30
- data/lib/elasticsearch/api/actions/rank_eval.rb +24 -15
- data/lib/elasticsearch/api/actions/reindex.rb +25 -48
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +18 -12
- data/lib/elasticsearch/api/actions/remote/info.rb +1 -2
- data/lib/elasticsearch/api/actions/render_search_template.rb +17 -15
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +8 -6
- data/lib/elasticsearch/api/actions/scroll.rb +28 -51
- data/lib/elasticsearch/api/actions/search.rb +104 -165
- data/lib/elasticsearch/api/actions/search_shards.rb +31 -28
- data/lib/elasticsearch/api/actions/search_template.rb +48 -40
- data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +44 -0
- data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -29
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +19 -24
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -22
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +16 -18
- data/lib/elasticsearch/api/actions/snapshot/get.rb +22 -31
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +21 -25
- data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +21 -32
- data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -24
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -13
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +19 -13
- data/lib/elasticsearch/api/actions/tasks/get.rb +16 -13
- data/lib/elasticsearch/api/actions/tasks/list.rb +20 -18
- data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/termvectors.rb +52 -70
- data/lib/elasticsearch/api/actions/update.rb +53 -98
- data/lib/elasticsearch/api/actions/update_by_query.rb +77 -66
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +17 -11
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/actions/cat/segments_spec.rb +9 -11
- data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/count_spec.rb +8 -8
- data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +12 -7
- data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -14
- data/spec/elasticsearch/api/actions/exists_document_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/get_document_source_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/index_document_spec.rb +6 -15
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -4
- data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -5
- data/spec/elasticsearch/api/actions/indices/clone_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +2 -2
- data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -11
- data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -1
- data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -15
- data/spec/elasticsearch/api/actions/render_search_template_spec.rb +23 -7
- data/spec/elasticsearch/api/actions/scroll_spec.rb +37 -0
- data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -11
- data/spec/elasticsearch/api/actions/update_document_spec.rb +3 -7
- data/spec/rest_yaml_tests_helper.rb +12 -0
- data/utils/Gemfile +1 -0
- data/utils/Thorfile +0 -1
- data/utils/thor/generate_source.rb +192 -85
- data/utils/thor/generator/endpoint_specifics.rb +157 -0
- data/utils/thor/generator/files_helper.rb +37 -0
- data/utils/thor/lister.rb +3 -4
- data/utils/thor/templates/_documentation_top.erb +27 -0
- data/utils/thor/templates/_method_setup.erb +35 -0
- data/utils/thor/templates/_params_registry.erb +12 -0
- data/utils/thor/templates/_perform_request.erb +37 -0
- data/utils/thor/templates/method.erb +59 -0
- data/utils/thor/templates/{ruby/test.erb → test.erb} +0 -0
- data/utils/thor/templates/{ruby/test_helper.rb → test_helper.rb} +0 -0
- metadata +19 -11
- data/spec/elasticsearch/api/actions/scoll_spec.rb +0 -21
- data/utils/thor/generate_api.rb +0 -193
- data/utils/thor/templates/ruby/method.erb +0 -62
@@ -6,91 +6,43 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Create an index.
|
11
|
-
#
|
12
|
-
# Pass the index `settings` and `mappings` in the `:body` attribute.
|
13
|
-
#
|
14
|
-
# @example Create an index with specific settings, custom analyzers and mappings
|
15
|
-
#
|
16
|
-
# client.indices.create index: 'test',
|
17
|
-
# body: {
|
18
|
-
# settings: {
|
19
|
-
# index: {
|
20
|
-
# number_of_shards: 1,
|
21
|
-
# number_of_replicas: 0,
|
22
|
-
# 'routing.allocation.include.name' => 'node-1'
|
23
|
-
# },
|
24
|
-
# analysis: {
|
25
|
-
# filter: {
|
26
|
-
# ngram: {
|
27
|
-
# type: 'nGram',
|
28
|
-
# min_gram: 3,
|
29
|
-
# max_gram: 25
|
30
|
-
# }
|
31
|
-
# },
|
32
|
-
# analyzer: {
|
33
|
-
# ngram: {
|
34
|
-
# tokenizer: 'whitespace',
|
35
|
-
# filter: ['lowercase', 'stop', 'ngram'],
|
36
|
-
# type: 'custom'
|
37
|
-
# },
|
38
|
-
# ngram_search: {
|
39
|
-
# tokenizer: 'whitespace',
|
40
|
-
# filter: ['lowercase', 'stop'],
|
41
|
-
# type: 'custom'
|
42
|
-
# }
|
43
|
-
# }
|
44
|
-
# }
|
45
|
-
# },
|
46
|
-
# mappings: {
|
47
|
-
# properties: {
|
48
|
-
# title: {
|
49
|
-
# type: 'multi_field',
|
50
|
-
# fields: {
|
51
|
-
# title: { type: 'string', analyzer: 'snowball' },
|
52
|
-
# exact: { type: 'string', analyzer: 'keyword' },
|
53
|
-
# ngram: { type: 'string',
|
54
|
-
# index_analyzer: 'ngram',
|
55
|
-
# search_analyzer: 'ngram_search'
|
56
|
-
# }
|
57
|
-
# }
|
58
|
-
# }
|
59
|
-
# }
|
60
|
-
# }
|
61
|
-
# }
|
9
|
+
# Creates an index with optional settings and mappings.
|
62
10
|
#
|
63
|
-
# @option arguments [String] :index The name of the index
|
64
|
-
# @option arguments [Hash] :body Optional configuration for the index (`settings` and `mappings`)
|
11
|
+
# @option arguments [String] :index The name of the index
|
65
12
|
# @option arguments [Boolean] :include_type_name Whether a type should be expected in the body of the mappings.
|
66
|
-
# @option arguments [
|
67
|
-
# with the same name across all types
|
68
|
-
# @option arguments [Number] :wait_for_active_shards Wait until the specified number of shards is active
|
13
|
+
# @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for before the operation returns.
|
69
14
|
# @option arguments [Time] :timeout Explicit operation timeout
|
70
|
-
# @option arguments [
|
15
|
+
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
16
|
+
|
17
|
+
# @option arguments [Hash] :body The configuration for the index (`settings` and `mappings`)
|
71
18
|
#
|
72
|
-
# @see https://www.elastic.co/guide/reference/
|
19
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-create-index.html
|
73
20
|
#
|
74
|
-
def create(arguments={})
|
21
|
+
def create(arguments = {})
|
75
22
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
76
|
-
method = HTTP_PUT
|
77
|
-
path = Utils.__pathify Utils.__escape(arguments[:index])
|
78
23
|
|
24
|
+
arguments = arguments.clone
|
25
|
+
|
26
|
+
_index = arguments.delete(:index)
|
27
|
+
|
28
|
+
method = Elasticsearch::API::HTTP_PUT
|
29
|
+
path = "#{Utils.__listify(_index)}"
|
79
30
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
80
|
-
body = arguments[:body]
|
81
31
|
|
32
|
+
body = arguments[:body]
|
82
33
|
perform_request(method, path, params, body).body
|
83
34
|
end
|
84
35
|
|
85
36
|
# Register this action with its valid params when the module is loaded.
|
86
37
|
#
|
87
|
-
# @since 6.
|
38
|
+
# @since 6.2.0
|
88
39
|
ParamsRegistry.register(:create, [
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
40
|
+
:include_type_name,
|
41
|
+
:wait_for_active_shards,
|
42
|
+
:timeout,
|
43
|
+
:master_timeout
|
44
|
+
].freeze)
|
45
|
+
end
|
93
46
|
end
|
94
|
-
end
|
95
47
|
end
|
96
48
|
end
|
@@ -6,44 +6,31 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Delete an index, list of indices, or all indices in the cluster.
|
11
|
-
#
|
12
|
-
# @example Delete an index
|
13
|
-
#
|
14
|
-
# client.indices.delete index: 'foo'
|
15
|
-
#
|
16
|
-
# @example Delete a list of indices
|
17
|
-
#
|
18
|
-
# client.indices.delete index: ['foo', 'bar']
|
19
|
-
# client.indices.delete index: 'foo,bar'
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# @example Delete a list of indices matching wildcard expression
|
9
|
+
# Deletes an index.
|
23
10
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# @example Delete all indices
|
27
|
-
#
|
28
|
-
# client.indices.delete index: '_all'
|
29
|
-
#
|
30
|
-
# @option arguments [List] :index A comma-separated list of indices to delete;
|
31
|
-
# use `_all` to delete all indices
|
11
|
+
# @option arguments [List] :index A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices
|
32
12
|
# @option arguments [Time] :timeout Explicit operation timeout
|
33
13
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
34
14
|
# @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false)
|
35
15
|
# @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false)
|
36
|
-
# @option arguments [
|
16
|
+
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open)
|
17
|
+
# (options: open,closed,none,all)
|
18
|
+
|
37
19
|
#
|
38
|
-
# @see https://www.elastic.co/guide/reference/
|
20
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-delete-index.html
|
39
21
|
#
|
40
|
-
def delete(arguments={})
|
41
|
-
|
42
|
-
path = Utils.__pathify Utils.__listify(arguments[:index])
|
22
|
+
def delete(arguments = {})
|
23
|
+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
43
24
|
|
25
|
+
arguments = arguments.clone
|
26
|
+
|
27
|
+
_index = arguments.delete(:index)
|
28
|
+
|
29
|
+
method = Elasticsearch::API::HTTP_DELETE
|
30
|
+
path = "#{Utils.__listify(_index)}"
|
44
31
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
45
|
-
body = nil
|
46
32
|
|
33
|
+
body = nil
|
47
34
|
if Array(arguments[:ignore]).include?(404)
|
48
35
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
49
36
|
else
|
@@ -53,14 +40,15 @@ module Elasticsearch
|
|
53
40
|
|
54
41
|
# Register this action with its valid params when the module is loaded.
|
55
42
|
#
|
56
|
-
# @since 6.
|
43
|
+
# @since 6.2.0
|
57
44
|
ParamsRegistry.register(:delete, [
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
45
|
+
:timeout,
|
46
|
+
:master_timeout,
|
47
|
+
:ignore_unavailable,
|
48
|
+
:allow_no_indices,
|
49
|
+
:expand_wildcards
|
50
|
+
].freeze)
|
51
|
+
end
|
63
52
|
end
|
64
|
-
end
|
65
53
|
end
|
66
54
|
end
|
@@ -6,40 +6,44 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Delete a single index alias.
|
11
|
-
#
|
12
|
-
# @example Delete an alias
|
13
|
-
#
|
14
|
-
# client.indices.delete_alias index: 'foo', name: 'bar'
|
9
|
+
# Deletes an alias.
|
15
10
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# @option arguments [String] :index The name of the index with an alias (*Required*)
|
19
|
-
# @option arguments [String] :name The name of the alias to be deleted (*Required*)
|
11
|
+
# @option arguments [List] :index A comma-separated list of index names (supports wildcards); use `_all` for all indices
|
12
|
+
# @option arguments [List] :name A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices.
|
20
13
|
# @option arguments [Time] :timeout Explicit timestamp for the document
|
14
|
+
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
15
|
+
|
21
16
|
#
|
22
|
-
# @see https://www.elastic.co/guide/reference/
|
17
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-aliases.html
|
23
18
|
#
|
24
|
-
def delete_alias(arguments={})
|
19
|
+
def delete_alias(arguments = {})
|
25
20
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
26
|
-
raise ArgumentError, "Required argument 'name' missing"
|
27
|
-
method = HTTP_DELETE
|
28
|
-
path = Utils.__pathify Utils.__escape(arguments[:index]), '_alias', Utils.__escape(arguments[:name])
|
21
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
29
22
|
|
23
|
+
arguments = arguments.clone
|
24
|
+
|
25
|
+
_index = arguments.delete(:index)
|
26
|
+
|
27
|
+
_name = arguments.delete(:name)
|
28
|
+
|
29
|
+
method = Elasticsearch::API::HTTP_DELETE
|
30
|
+
path = if _index && _name
|
31
|
+
"#{Utils.__listify(_index)}/_aliases/#{Utils.__listify(_name)}"
|
32
|
+
end
|
30
33
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
31
|
-
body = nil
|
32
34
|
|
35
|
+
body = nil
|
33
36
|
perform_request(method, path, params, body).body
|
34
37
|
end
|
35
38
|
|
36
39
|
# Register this action with its valid params when the module is loaded.
|
37
40
|
#
|
38
|
-
# @since 6.
|
41
|
+
# @since 6.2.0
|
39
42
|
ParamsRegistry.register(:delete_alias, [
|
40
|
-
|
41
|
-
|
43
|
+
:timeout,
|
44
|
+
:master_timeout
|
45
|
+
].freeze)
|
46
|
+
end
|
42
47
|
end
|
43
|
-
end
|
44
48
|
end
|
45
49
|
end
|
@@ -6,30 +6,27 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Delete an index template.
|
11
|
-
#
|
12
|
-
# @example Delete a template named _mytemplate_
|
13
|
-
#
|
14
|
-
# client.indices.delete_template name: 'mytemplate'
|
9
|
+
# Deletes an index template.
|
15
10
|
#
|
16
|
-
# @
|
17
|
-
#
|
18
|
-
# client.indices.delete_template name: '*'
|
19
|
-
#
|
20
|
-
# @option arguments [String] :name The name of the template (*Required*)
|
11
|
+
# @option arguments [String] :name The name of the template
|
21
12
|
# @option arguments [Time] :timeout Explicit operation timeout
|
13
|
+
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
14
|
+
|
22
15
|
#
|
23
|
-
# @see https://www.elastic.co/guide/reference/
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-templates.html
|
24
17
|
#
|
25
|
-
def delete_template(arguments={})
|
18
|
+
def delete_template(arguments = {})
|
26
19
|
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
27
|
-
method = HTTP_DELETE
|
28
|
-
path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
|
29
20
|
|
21
|
+
arguments = arguments.clone
|
22
|
+
|
23
|
+
_name = arguments.delete(:name)
|
24
|
+
|
25
|
+
method = Elasticsearch::API::HTTP_DELETE
|
26
|
+
path = "_template/#{Utils.__listify(_name)}"
|
30
27
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
31
|
-
body = nil
|
32
28
|
|
29
|
+
body = nil
|
33
30
|
if Array(arguments[:ignore]).include?(404)
|
34
31
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
35
32
|
else
|
@@ -39,11 +36,12 @@ module Elasticsearch
|
|
39
36
|
|
40
37
|
# Register this action with its valid params when the module is loaded.
|
41
38
|
#
|
42
|
-
# @since 6.
|
39
|
+
# @since 6.2.0
|
43
40
|
ParamsRegistry.register(:delete_template, [
|
44
|
-
|
45
|
-
|
41
|
+
:timeout,
|
42
|
+
:master_timeout
|
43
|
+
].freeze)
|
44
|
+
end
|
46
45
|
end
|
47
|
-
end
|
48
46
|
end
|
49
47
|
end
|
@@ -6,54 +6,52 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return true if the index (or all indices in a list) exists, false otherwise.
|
11
|
-
#
|
12
|
-
# @example Check whether index named _myindex_ exists
|
13
|
-
#
|
14
|
-
# client.indices.exists? index: 'myindex'
|
15
|
-
#
|
16
|
-
# @option arguments [List] :index A comma-separated list of indices to check (*Required*)
|
17
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
18
|
-
# no concrete indices. (This includes `_all` string or when no
|
19
|
-
# indices have been specified)
|
20
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
|
21
|
-
# are open, closed or both. (options: open, closed)
|
22
|
-
# @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
|
23
|
-
# `missing` ones (options: none, missing) @until 1.0
|
24
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
25
|
-
# unavailable (missing, closed, etc)
|
26
|
-
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
27
|
-
# (default: false)
|
9
|
+
# Returns information about whether a particular index exists.
|
28
10
|
#
|
29
|
-
# @
|
11
|
+
# @option arguments [List] :index A comma-separated list of index names
|
12
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
|
13
|
+
# @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false)
|
14
|
+
# @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false)
|
15
|
+
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open)
|
16
|
+
# (options: open,closed,none,all)
|
17
|
+
|
18
|
+
# @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
|
19
|
+
# @option arguments [Boolean] :include_defaults Whether to return all default setting for each of the indices.
|
20
|
+
|
30
21
|
#
|
31
|
-
# @see https://www.elastic.co/guide/reference/
|
22
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-exists.html
|
32
23
|
#
|
33
|
-
def exists(arguments={})
|
24
|
+
def exists(arguments = {})
|
34
25
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
35
|
-
|
36
|
-
|
26
|
+
|
27
|
+
arguments = arguments.clone
|
28
|
+
|
29
|
+
_index = arguments.delete(:index)
|
30
|
+
|
31
|
+
method = Elasticsearch::API::HTTP_HEAD
|
32
|
+
path = "#{Utils.__listify(_index)}"
|
37
33
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
38
|
-
|
34
|
+
|
35
|
+
body = nil
|
39
36
|
|
40
37
|
Utils.__rescue_from_not_found do
|
41
38
|
perform_request(method, path, params, body).status == 200 ? true : false
|
42
39
|
end
|
43
40
|
end
|
44
|
-
alias_method :exists?, :exists
|
45
41
|
|
42
|
+
alias_method :exists?, :exists
|
46
43
|
# Register this action with its valid params when the module is loaded.
|
47
44
|
#
|
48
|
-
# @since 6.
|
45
|
+
# @since 6.2.0
|
49
46
|
ParamsRegistry.register(:exists, [
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
:local,
|
48
|
+
:ignore_unavailable,
|
49
|
+
:allow_no_indices,
|
50
|
+
:expand_wildcards,
|
51
|
+
:flat_settings,
|
52
|
+
:include_defaults
|
53
|
+
].freeze)
|
54
|
+
end
|
56
55
|
end
|
57
|
-
end
|
58
56
|
end
|
59
57
|
end
|
@@ -6,51 +6,55 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return true if the specified alias exists, false otherwise.
|
11
|
-
#
|
12
|
-
# @example Check whether index alias named _myalias_ exists
|
9
|
+
# Returns information about whether a particular alias exists.
|
13
10
|
#
|
14
|
-
# client.indices.exists_alias? name: 'myalias'
|
15
|
-
#
|
16
|
-
# @option arguments [List] :index A comma-separated list of index names to filter aliases
|
17
11
|
# @option arguments [List] :name A comma-separated list of alias names to return
|
18
|
-
# @option arguments [
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
|
22
|
-
#
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
# unavailable (missing, closed, etc)
|
27
|
-
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
28
|
-
# (default: false)
|
12
|
+
# @option arguments [List] :index A comma-separated list of index names to filter aliases
|
13
|
+
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
14
|
+
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
15
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
16
|
+
# (options: open,closed,none,all)
|
17
|
+
|
18
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
|
19
|
+
|
29
20
|
#
|
30
|
-
# @see https://www.elastic.co/guide/reference/
|
21
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-aliases.html
|
31
22
|
#
|
32
|
-
def exists_alias(arguments={})
|
33
|
-
|
34
|
-
|
23
|
+
def exists_alias(arguments = {})
|
24
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
25
|
+
|
26
|
+
arguments = arguments.clone
|
35
27
|
|
28
|
+
_name = arguments.delete(:name)
|
29
|
+
|
30
|
+
_index = arguments.delete(:index)
|
31
|
+
|
32
|
+
method = Elasticsearch::API::HTTP_HEAD
|
33
|
+
path = if _index && _name
|
34
|
+
"#{Utils.__listify(_index)}/_alias/#{Utils.__listify(_name)}"
|
35
|
+
else
|
36
|
+
"_alias/#{Utils.__listify(_name)}"
|
37
|
+
end
|
36
38
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
39
|
+
|
37
40
|
body = nil
|
38
41
|
|
39
42
|
Utils.__rescue_from_not_found do
|
40
43
|
perform_request(method, path, params, body).status == 200 ? true : false
|
41
44
|
end
|
42
45
|
end
|
43
|
-
alias_method :exists_alias?, :exists_alias
|
44
46
|
|
47
|
+
alias_method :exists_alias?, :exists_alias
|
45
48
|
# Register this action with its valid params when the module is loaded.
|
46
49
|
#
|
47
|
-
# @since 6.
|
50
|
+
# @since 6.2.0
|
48
51
|
ParamsRegistry.register(:exists_alias, [
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
:ignore_unavailable,
|
53
|
+
:allow_no_indices,
|
54
|
+
:expand_wildcards,
|
55
|
+
:local
|
56
|
+
].freeze)
|
57
|
+
end
|
53
58
|
end
|
54
|
-
end
|
55
59
|
end
|
56
60
|
end
|