elasticsearch-api 7.3.0 → 7.5.0
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/elasticsearch-api.gemspec +1 -1
- 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 +50 -0
- 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 +109 -0
- 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/elasticsearch/api/rest_api_yaml_spec.rb +1 -1
- 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 +31 -14
- 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,63 +6,64 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Create or update mapping.
|
11
|
-
#
|
12
|
-
# Pass the mapping definition(s) in the `:body` argument.
|
13
|
-
#
|
14
|
-
# @example Create or update a mapping for a specific document type
|
15
|
-
#
|
16
|
-
# client.indices.put_mapping index: 'myindex', type: 'mytype', body: {
|
17
|
-
# mytype: {
|
18
|
-
# properties: {
|
19
|
-
# title: { type: 'text', analyzer: 'snowball' }
|
20
|
-
# }
|
21
|
-
# }
|
22
|
-
# }
|
23
|
-
#
|
24
|
-
# @example Update the mapping for a specific type in all indices
|
25
|
-
#
|
26
|
-
# client.indices.put_mapping type: 'mytype', body: {
|
27
|
-
# mytype: {
|
28
|
-
# dynamic: 'strict'
|
29
|
-
# }
|
30
|
-
# }
|
9
|
+
# Updates the index mappings.
|
31
10
|
#
|
32
11
|
# @option arguments [List] :index A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices.
|
33
|
-
# @option arguments [String] :type The name of the document type
|
34
|
-
# @option arguments [Hash] :body The mapping definition (*Required*)
|
12
|
+
# @option arguments [String] :type The name of the document type *Deprecated*
|
35
13
|
# @option arguments [Boolean] :include_type_name Whether a type should be expected in the body of the mappings.
|
36
14
|
# @option arguments [Time] :timeout Explicit operation timeout
|
37
15
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
38
16
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
39
17
|
# @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)
|
40
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
18
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
19
|
+
# (options: open,closed,none,all)
|
20
|
+
|
21
|
+
# @option arguments [Hash] :body The mapping definition (*Required*)
|
22
|
+
#
|
23
|
+
# *Deprecation notice*:
|
24
|
+
# Specifying types in urls has been deprecated
|
25
|
+
# Deprecated since version 7.0.0
|
41
26
|
#
|
42
|
-
# @see https://www.elastic.co/guide/reference/api/admin-indices-put-mapping/
|
43
27
|
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
28
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-put-mapping.html
|
29
|
+
#
|
30
|
+
def put_mapping(arguments = {})
|
31
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
32
|
+
|
33
|
+
arguments = arguments.clone
|
48
34
|
|
35
|
+
_index = arguments.delete(:index)
|
36
|
+
|
37
|
+
_type = arguments.delete(:type)
|
38
|
+
|
39
|
+
method = Elasticsearch::API::HTTP_PUT
|
40
|
+
path = if _index && _type
|
41
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_mappings"
|
42
|
+
elsif _type
|
43
|
+
"_mappings/#{Utils.__listify(_type)}"
|
44
|
+
elsif _index
|
45
|
+
"#{Utils.__listify(_index)}/_mappings"
|
46
|
+
else
|
47
|
+
"_mapping/#{Utils.__listify(_type)}"
|
48
|
+
end
|
49
49
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
50
|
-
body = arguments[:body]
|
51
50
|
|
51
|
+
body = arguments[:body]
|
52
52
|
perform_request(method, path, params, body).body
|
53
53
|
end
|
54
54
|
|
55
55
|
# Register this action with its valid params when the module is loaded.
|
56
56
|
#
|
57
|
-
# @since 6.
|
57
|
+
# @since 6.2.0
|
58
58
|
ParamsRegistry.register(:put_mapping, [
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
:include_type_name,
|
60
|
+
:timeout,
|
61
|
+
:master_timeout,
|
62
|
+
:ignore_unavailable,
|
63
|
+
:allow_no_indices,
|
64
|
+
:expand_wildcards
|
65
|
+
].freeze)
|
66
|
+
end
|
65
67
|
end
|
66
|
-
end
|
67
68
|
end
|
68
69
|
end
|
@@ -6,62 +6,55 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Update the settings for one or multiple indices.
|
11
|
-
#
|
12
|
-
# @example Change the number of replicas for all indices
|
13
|
-
#
|
14
|
-
# client.indices.put_settings body: { index: { number_of_replicas: 0 } }
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# @example Change the number of replicas for a specific index
|
18
|
-
#
|
19
|
-
# client.indices.put_settings index: 'myindex', body: { index: { number_of_replicas: 0 } }
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# @example Disable "flush" for all indices
|
23
|
-
#
|
24
|
-
# client.indices.put_settings body: { 'index.translog.disable_flush' => true }
|
25
|
-
#
|
26
|
-
# @example Allocate specific index on specific nodes
|
27
|
-
#
|
28
|
-
# client.indices.put_settings index: 'my-big-index',
|
29
|
-
# body: { 'index.routing.allocation.require.tag' => 'bigbox' }
|
9
|
+
# Updates the index settings.
|
30
10
|
#
|
31
11
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
32
|
-
# @option arguments [Hash] :body The index settings to be updated (*Required*)
|
33
12
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
34
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
35
14
|
# @option arguments [Boolean] :preserve_existing Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`
|
36
15
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
37
16
|
# @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)
|
38
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
17
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
18
|
+
# (options: open,closed,none,all)
|
19
|
+
|
39
20
|
# @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
|
21
|
+
|
22
|
+
# @option arguments [Hash] :body The index settings to be updated (*Required*)
|
40
23
|
#
|
41
|
-
# @see https://www.elastic.co/guide/reference/
|
24
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-update-settings.html
|
42
25
|
#
|
43
|
-
def put_settings(arguments={})
|
26
|
+
def put_settings(arguments = {})
|
44
27
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
45
|
-
|
46
|
-
|
28
|
+
|
29
|
+
arguments = arguments.clone
|
30
|
+
|
31
|
+
_index = arguments.delete(:index)
|
32
|
+
|
33
|
+
method = Elasticsearch::API::HTTP_PUT
|
34
|
+
path = if _index
|
35
|
+
"#{Utils.__listify(_index)}/_settings"
|
36
|
+
else
|
37
|
+
"_settings"
|
38
|
+
end
|
47
39
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
48
|
-
body = arguments[:body]
|
49
40
|
|
41
|
+
body = arguments[:body]
|
50
42
|
perform_request(method, path, params, body).body
|
51
43
|
end
|
52
44
|
|
53
45
|
# Register this action with its valid params when the module is loaded.
|
54
46
|
#
|
55
|
-
# @since 6.
|
47
|
+
# @since 6.2.0
|
56
48
|
ParamsRegistry.register(:put_settings, [
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
49
|
+
:master_timeout,
|
50
|
+
:timeout,
|
51
|
+
:preserve_existing,
|
52
|
+
:ignore_unavailable,
|
53
|
+
:allow_no_indices,
|
54
|
+
:expand_wildcards,
|
55
|
+
:flat_settings
|
56
|
+
].freeze)
|
57
|
+
end
|
64
58
|
end
|
65
|
-
end
|
66
59
|
end
|
67
60
|
end
|
@@ -6,48 +6,48 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Create or update an index template.
|
11
|
-
#
|
12
|
-
# @example Create a template for all indices starting with `logs-`
|
13
|
-
#
|
14
|
-
# client.indices.put_template name: 'foo',
|
15
|
-
# body: { template: 'logs-*', settings: { 'index.number_of_shards' => 1 } }
|
9
|
+
# Creates or updates an index template.
|
16
10
|
#
|
17
|
-
# @option arguments [String] :name The name of the template
|
18
|
-
# @option arguments [Hash] :body The template definition (*Required*)
|
11
|
+
# @option arguments [String] :name The name of the template
|
19
12
|
# @option arguments [Boolean] :include_type_name Whether a type should be returned in the body of the mappings.
|
20
13
|
# @option arguments [Number] :order The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)
|
21
14
|
# @option arguments [Boolean] :create Whether the index template should only be added if new or can also replace an existing one
|
22
15
|
# @option arguments [Time] :timeout Explicit operation timeout
|
23
16
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
24
17
|
# @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
|
18
|
+
|
19
|
+
# @option arguments [Hash] :body The template definition (*Required*)
|
25
20
|
#
|
26
|
-
# @see https://www.elastic.co/guide/reference/
|
21
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-templates.html
|
27
22
|
#
|
28
|
-
def put_template(arguments={})
|
29
|
-
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
23
|
+
def put_template(arguments = {})
|
30
24
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
31
|
-
|
32
|
-
|
25
|
+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
|
26
|
+
|
27
|
+
arguments = arguments.clone
|
33
28
|
|
29
|
+
_name = arguments.delete(:name)
|
30
|
+
|
31
|
+
method = Elasticsearch::API::HTTP_PUT
|
32
|
+
path = "_template/#{Utils.__listify(_name)}"
|
34
33
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
35
|
-
body = arguments[:body]
|
36
34
|
|
35
|
+
body = arguments[:body]
|
37
36
|
perform_request(method, path, params, body).body
|
38
37
|
end
|
39
38
|
|
40
39
|
# Register this action with its valid params when the module is loaded.
|
41
40
|
#
|
42
|
-
# @since 6.
|
41
|
+
# @since 6.2.0
|
43
42
|
ParamsRegistry.register(:put_template, [
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
:include_type_name,
|
44
|
+
:order,
|
45
|
+
:create,
|
46
|
+
:timeout,
|
47
|
+
:master_timeout,
|
48
|
+
:flat_settings
|
49
|
+
].freeze)
|
50
|
+
end
|
50
51
|
end
|
51
|
-
end
|
52
52
|
end
|
53
53
|
end
|
@@ -6,43 +6,40 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return information about shard recovery for one or more indices
|
11
|
-
#
|
12
|
-
# @example Get recovery information for a single index
|
13
|
-
#
|
14
|
-
# client.indices.recovery index: 'foo'
|
15
|
-
#
|
16
|
-
# @example Get detailed recovery information for multiple indices
|
17
|
-
#
|
18
|
-
# client.indices.recovery index: ['foo', 'bar'], detailed: true
|
19
|
-
#
|
20
|
-
# @example Get recovery information for all indices
|
21
|
-
#
|
22
|
-
# client.indices.recovery
|
9
|
+
# Returns information about ongoing index shard recoveries.
|
23
10
|
#
|
24
11
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
25
12
|
# @option arguments [Boolean] :detailed Whether to display detailed information about shard recovery
|
26
13
|
# @option arguments [Boolean] :active_only Display only those recoveries that are currently on-going
|
14
|
+
|
27
15
|
#
|
28
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-recovery.html
|
29
17
|
#
|
30
|
-
def recovery(arguments={})
|
31
|
-
|
32
|
-
|
18
|
+
def recovery(arguments = {})
|
19
|
+
arguments = arguments.clone
|
20
|
+
|
21
|
+
_index = arguments.delete(:index)
|
22
|
+
|
23
|
+
method = Elasticsearch::API::HTTP_GET
|
24
|
+
path = if _index
|
25
|
+
"#{Utils.__listify(_index)}/_recovery"
|
26
|
+
else
|
27
|
+
"_recovery"
|
28
|
+
end
|
33
29
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
34
|
-
body = nil
|
35
30
|
|
31
|
+
body = nil
|
36
32
|
perform_request(method, path, params, body).body
|
37
33
|
end
|
38
34
|
|
39
35
|
# Register this action with its valid params when the module is loaded.
|
40
36
|
#
|
41
|
-
# @since 6.
|
37
|
+
# @since 6.2.0
|
42
38
|
ParamsRegistry.register(:recovery, [
|
43
|
-
|
44
|
-
|
39
|
+
:detailed,
|
40
|
+
:active_only
|
41
|
+
].freeze)
|
42
|
+
end
|
45
43
|
end
|
46
|
-
end
|
47
44
|
end
|
48
45
|
end
|
@@ -6,47 +6,43 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Refresh the index and to make the changes (creates, updates, deletes) searchable.
|
11
|
-
#
|
12
|
-
# By default, Elasticsearch has a delay of 1 second until changes to an index are
|
13
|
-
# available for search; the delay is configurable, see {Indices::Actions#put_settings}.
|
14
|
-
#
|
15
|
-
# You can trigger this operation explicitly, for example when performing a sequence of commands
|
16
|
-
# in integration tests, or when you need to perform a manual "synchronization" of the index
|
17
|
-
# with an external system at given moment.
|
18
|
-
#
|
19
|
-
# @example Refresh an index named _myindex_
|
20
|
-
#
|
21
|
-
# client.indices.refresh index: 'myindex'
|
22
|
-
#
|
23
|
-
# @note The refresh operation can adversely affect indexing throughput when used too frequently.
|
9
|
+
# Performs the refresh operation in one or more indices.
|
24
10
|
#
|
25
11
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
26
12
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
27
13
|
# @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)
|
28
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
14
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
15
|
+
# (options: open,closed,none,all)
|
16
|
+
|
29
17
|
#
|
30
|
-
# @see https://www.elastic.co/guide/reference/
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-refresh.html
|
31
19
|
#
|
32
|
-
def refresh(arguments={})
|
33
|
-
|
34
|
-
|
20
|
+
def refresh(arguments = {})
|
21
|
+
arguments = arguments.clone
|
22
|
+
|
23
|
+
_index = arguments.delete(:index)
|
35
24
|
|
25
|
+
method = Elasticsearch::API::HTTP_POST
|
26
|
+
path = if _index
|
27
|
+
"#{Utils.__listify(_index)}/_refresh"
|
28
|
+
else
|
29
|
+
"_refresh"
|
30
|
+
end
|
36
31
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
37
|
-
body = nil
|
38
32
|
|
33
|
+
body = nil
|
39
34
|
perform_request(method, path, params, body).body
|
40
35
|
end
|
41
36
|
|
42
37
|
# Register this action with its valid params when the module is loaded.
|
43
38
|
#
|
44
|
-
# @since 6.
|
39
|
+
# @since 6.2.0
|
45
40
|
ParamsRegistry.register(:refresh, [
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
:ignore_unavailable,
|
42
|
+
:allow_no_indices,
|
43
|
+
:expand_wildcards
|
44
|
+
].freeze)
|
45
|
+
end
|
49
46
|
end
|
50
|
-
end
|
51
47
|
end
|
52
48
|
end
|
@@ -6,44 +6,53 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
#
|
11
|
-
# is considered to be too large or too old
|
9
|
+
# Updates an alias to point to a new index when the existing index
|
10
|
+
# is considered to be too large or too old.
|
12
11
|
#
|
13
|
-
# @option arguments [String] :alias The name of the alias to rollover
|
12
|
+
# @option arguments [String] :alias The name of the alias to rollover
|
14
13
|
# @option arguments [String] :new_index The name of the rollover index
|
15
|
-
# @option arguments [Hash] :body The conditions that needs to be met for executing rollover
|
16
14
|
# @option arguments [Boolean] :include_type_name Whether a type should be included in the body of the mappings.
|
17
15
|
# @option arguments [Time] :timeout Explicit operation timeout
|
18
16
|
# @option arguments [Boolean] :dry_run If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false
|
19
17
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
20
18
|
# @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the newly created rollover index before the operation returns.
|
19
|
+
|
20
|
+
# @option arguments [Hash] :body The conditions that needs to be met for executing rollover
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-rollover-index.html
|
23
23
|
#
|
24
|
-
def rollover(arguments={})
|
24
|
+
def rollover(arguments = {})
|
25
25
|
raise ArgumentError, "Required argument 'alias' missing" unless arguments[:alias]
|
26
|
+
|
26
27
|
arguments = arguments.clone
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
|
29
|
+
_alias = arguments.delete(:alias)
|
30
|
+
|
31
|
+
_new_index = arguments.delete(:new_index)
|
32
|
+
|
33
|
+
method = Elasticsearch::API::HTTP_POST
|
34
|
+
path = if _alias && _new_index
|
35
|
+
"#{Utils.__listify(_alias)}/_rollover/#{Utils.__listify(_new_index)}"
|
36
|
+
else
|
37
|
+
"#{Utils.__listify(_alias)}/_rollover"
|
38
|
+
end
|
31
39
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
32
|
-
body = arguments[:body]
|
33
40
|
|
41
|
+
body = arguments[:body]
|
34
42
|
perform_request(method, path, params, body).body
|
35
43
|
end
|
36
44
|
|
37
45
|
# Register this action with its valid params when the module is loaded.
|
38
46
|
#
|
39
|
-
# @since 6.
|
47
|
+
# @since 6.2.0
|
40
48
|
ParamsRegistry.register(:rollover, [
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
:include_type_name,
|
50
|
+
:timeout,
|
51
|
+
:dry_run,
|
52
|
+
:master_timeout,
|
53
|
+
:wait_for_active_shards
|
54
|
+
].freeze)
|
55
|
+
end
|
46
56
|
end
|
47
|
-
end
|
48
57
|
end
|
49
58
|
end
|
@@ -6,39 +6,46 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return information about segments for one or more indices.
|
11
|
-
#
|
12
|
-
# The response contains information about segment size, number of documents, deleted documents, etc.
|
13
|
-
# See also {Indices::Actions#optimize}.
|
9
|
+
# Provides low-level information about segments in a Lucene index.
|
14
10
|
#
|
15
11
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
16
12
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
17
13
|
# @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)
|
18
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
14
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
15
|
+
# (options: open,closed,none,all)
|
16
|
+
|
19
17
|
# @option arguments [Boolean] :verbose Includes detailed memory usage by Lucene.
|
18
|
+
|
20
19
|
#
|
21
|
-
# @see
|
20
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-segments.html
|
22
21
|
#
|
23
|
-
def segments(arguments={})
|
24
|
-
|
25
|
-
path = Utils.__pathify Utils.__listify(arguments[:index]), '_segments'
|
22
|
+
def segments(arguments = {})
|
23
|
+
arguments = arguments.clone
|
26
24
|
|
25
|
+
_index = arguments.delete(:index)
|
26
|
+
|
27
|
+
method = Elasticsearch::API::HTTP_GET
|
28
|
+
path = if _index
|
29
|
+
"#{Utils.__listify(_index)}/_segments"
|
30
|
+
else
|
31
|
+
"_segments"
|
32
|
+
end
|
27
33
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
28
|
-
body = nil
|
29
34
|
|
35
|
+
body = nil
|
30
36
|
perform_request(method, path, params, body).body
|
31
37
|
end
|
32
38
|
|
33
39
|
# Register this action with its valid params when the module is loaded.
|
34
40
|
#
|
35
|
-
# @since 6.
|
41
|
+
# @since 6.2.0
|
36
42
|
ParamsRegistry.register(:segments, [
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
:ignore_unavailable,
|
44
|
+
:allow_no_indices,
|
45
|
+
:expand_wildcards,
|
46
|
+
:verbose
|
47
|
+
].freeze)
|
48
|
+
end
|
41
49
|
end
|
42
|
-
end
|
43
50
|
end
|
44
51
|
end
|
@@ -6,35 +6,47 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Provides low-level information about shards (allocated nodes, exceptions, ...)
|
9
|
+
# Provides store information for shard copies of indices.
|
11
10
|
#
|
12
11
|
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
13
|
-
# @option arguments [List] :status A comma-separated list of statuses used to filter on shards to get store information for
|
12
|
+
# @option arguments [List] :status A comma-separated list of statuses used to filter on shards to get store information for
|
13
|
+
# (options: green,yellow,red,all)
|
14
|
+
|
14
15
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
15
16
|
# @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)
|
16
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
17
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
18
|
+
# (options: open,closed,none,all)
|
19
|
+
|
17
20
|
#
|
18
|
-
# @see
|
21
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-shards-stores.html
|
19
22
|
#
|
20
|
-
def shard_stores(arguments={})
|
21
|
-
|
22
|
-
|
23
|
+
def shard_stores(arguments = {})
|
24
|
+
arguments = arguments.clone
|
25
|
+
|
26
|
+
_index = arguments.delete(:index)
|
27
|
+
|
28
|
+
method = Elasticsearch::API::HTTP_GET
|
29
|
+
path = if _index
|
30
|
+
"#{Utils.__listify(_index)}/_shard_stores"
|
31
|
+
else
|
32
|
+
"_shard_stores"
|
33
|
+
end
|
23
34
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
24
|
-
body = nil
|
25
35
|
|
36
|
+
body = nil
|
26
37
|
perform_request(method, path, params, body).body
|
27
38
|
end
|
28
39
|
|
29
40
|
# Register this action with its valid params when the module is loaded.
|
30
41
|
#
|
31
|
-
# @since 6.
|
42
|
+
# @since 6.2.0
|
32
43
|
ParamsRegistry.register(:shard_stores, [
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
44
|
+
:status,
|
45
|
+
:ignore_unavailable,
|
46
|
+
:allow_no_indices,
|
47
|
+
:expand_wildcards
|
48
|
+
].freeze)
|
49
|
+
end
|
37
50
|
end
|
38
|
-
end
|
39
51
|
end
|
40
52
|
end
|