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,41 +6,47 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Copy an existing index into a new index with a fewer number of primary shards
|
9
|
+
# Allow to shrink an existing index into a new index with fewer primary shards.
|
11
10
|
#
|
12
|
-
# @option arguments [String] :index The name of the source index to shrink
|
13
|
-
# @option arguments [String] :target The name of the target index to shrink into
|
14
|
-
# @option arguments [
|
11
|
+
# @option arguments [String] :index The name of the source index to shrink
|
12
|
+
# @option arguments [String] :target The name of the target index to shrink into
|
13
|
+
# @option arguments [Boolean] :copy_settings whether or not to copy settings from the source index (defaults to false)
|
15
14
|
# @option arguments [Time] :timeout Explicit operation timeout
|
16
15
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
17
16
|
# @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the shrunken index before the operation returns.
|
17
|
+
|
18
|
+
# @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)
|
18
19
|
#
|
19
|
-
# @see
|
20
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-shrink-index.html
|
20
21
|
#
|
21
|
-
def shrink(arguments={})
|
22
|
+
def shrink(arguments = {})
|
22
23
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
23
24
|
raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]
|
25
|
+
|
24
26
|
arguments = arguments.clone
|
25
|
-
source = arguments.delete(:index)
|
26
|
-
target = arguments.delete(:target)
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
_index = arguments.delete(:index)
|
29
|
+
|
30
|
+
_target = arguments.delete(:target)
|
31
|
+
|
32
|
+
method = Elasticsearch::API::HTTP_PUT
|
33
|
+
path = "#{Utils.__listify(_index)}/_shrink/#{Utils.__listify(_target)}"
|
30
34
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
31
|
-
body = arguments[:body]
|
32
35
|
|
36
|
+
body = arguments[:body]
|
33
37
|
perform_request(method, path, params, body).body
|
34
38
|
end
|
35
39
|
|
36
40
|
# Register this action with its valid params when the module is loaded.
|
37
41
|
#
|
38
|
-
# @since 6.
|
42
|
+
# @since 6.2.0
|
39
43
|
ParamsRegistry.register(:shrink, [
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
:copy_settings,
|
45
|
+
:timeout,
|
46
|
+
:master_timeout,
|
47
|
+
:wait_for_active_shards
|
48
|
+
].freeze)
|
49
|
+
end
|
43
50
|
end
|
44
|
-
end
|
45
51
|
end
|
46
52
|
end
|
@@ -6,41 +6,47 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# The split index API allows you to split an existing index into a new index with multiple of its primary shards.
|
9
|
+
# Allows you to split an existing index into a new index with more primary shards.
|
11
10
|
#
|
12
|
-
# @option arguments [String] :index The name of the source index to split
|
13
|
-
# @option arguments [String] :target The name of the target index to split into
|
14
|
-
# @option arguments [
|
11
|
+
# @option arguments [String] :index The name of the source index to split
|
12
|
+
# @option arguments [String] :target The name of the target index to split into
|
13
|
+
# @option arguments [Boolean] :copy_settings whether or not to copy settings from the source index (defaults to false)
|
15
14
|
# @option arguments [Time] :timeout Explicit operation timeout
|
16
15
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
17
16
|
# @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the shrunken index before the operation returns.
|
17
|
+
|
18
|
+
# @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)
|
18
19
|
#
|
19
|
-
# @see
|
20
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-split-index.html
|
20
21
|
#
|
21
|
-
def split(arguments={})
|
22
|
+
def split(arguments = {})
|
22
23
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
23
24
|
raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]
|
25
|
+
|
24
26
|
arguments = arguments.clone
|
25
|
-
|
26
|
-
|
27
|
+
|
28
|
+
_index = arguments.delete(:index)
|
29
|
+
|
30
|
+
_target = arguments.delete(:target)
|
27
31
|
|
28
32
|
method = Elasticsearch::API::HTTP_PUT
|
29
|
-
path = Utils.
|
30
|
-
params =
|
31
|
-
body = arguments[:body]
|
33
|
+
path = "#{Utils.__listify(_index)}/_split/#{Utils.__listify(_target)}"
|
34
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
32
35
|
|
36
|
+
body = arguments[:body]
|
33
37
|
perform_request(method, path, params, body).body
|
34
38
|
end
|
35
39
|
|
36
40
|
# Register this action with its valid params when the module is loaded.
|
37
41
|
#
|
38
|
-
# @since 6.
|
42
|
+
# @since 6.2.0
|
39
43
|
ParamsRegistry.register(:split, [
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
:copy_settings,
|
45
|
+
:timeout,
|
46
|
+
:master_timeout,
|
47
|
+
:wait_for_active_shards
|
48
|
+
].freeze)
|
49
|
+
end
|
43
50
|
end
|
44
|
-
end
|
45
51
|
end
|
46
52
|
end
|
@@ -6,129 +6,78 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return statistical information about one or more indices.
|
11
|
-
#
|
12
|
-
# The response contains comprehensive statistical information about metrics related to index:
|
13
|
-
# how much time did indexing, search and other operations take, how much disk space it takes,
|
14
|
-
# how much memory filter caches or field data require, etc.
|
15
|
-
#
|
16
|
-
# @example Get all available statistics for all indices
|
17
|
-
#
|
18
|
-
# client.indices.stats
|
19
|
-
#
|
20
|
-
# @example Get statistics for a single index
|
21
|
-
#
|
22
|
-
# client.indices.stats index: 'foo'
|
23
|
-
#
|
24
|
-
# @example Get statistics about documents and disk size for multiple indices
|
25
|
-
#
|
26
|
-
# client.indices.stats index: ['foo', 'bar'], docs: true, store: true
|
27
|
-
#
|
28
|
-
# @example Get statistics about filter cache and field data for all fields
|
29
|
-
#
|
30
|
-
# client.indices.stats fielddata: true, filter_cache: true
|
31
|
-
#
|
32
|
-
# @example Get statistics about filter cache and field data for specific fields
|
33
|
-
#
|
34
|
-
# client.indices.stats fielddata: true, filter_cache: true, fields: 'created_at,tags'
|
35
|
-
#
|
36
|
-
# @example Get statistics about filter cache and field data per field for all fields
|
9
|
+
# Provides statistics on operations happening in an index.
|
37
10
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
# @option arguments [
|
45
|
-
# @option arguments [
|
46
|
-
# @option arguments [Boolean] :fields A comma-separated list of fields for `fielddata` metric (supports wildcards)
|
47
|
-
# @option arguments [Boolean] :filter_cache Return information about filter cache
|
48
|
-
# @option arguments [Boolean] :flush Return information about flush operations
|
49
|
-
# @option arguments [Boolean] :get Return information about get operations
|
50
|
-
# @option arguments [Boolean] :groups A comma-separated list of search groups for `search` statistics
|
51
|
-
# @option arguments [Boolean] :id_cache Return information about ID cache
|
52
|
-
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
|
53
|
-
# to perform the operation on all indices
|
54
|
-
# @option arguments [Boolean] :indexing Return information about indexing operations
|
11
|
+
# @option arguments [List] :metric Limit the information returned the specific metrics.
|
12
|
+
# (options: _all,completion,docs,fielddata,query_cache,flush,get,indexing,merge,request_cache,refresh,search,segments,store,warmer,suggest)
|
13
|
+
|
14
|
+
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
15
|
+
# @option arguments [List] :completion_fields A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)
|
16
|
+
# @option arguments [List] :fielddata_fields A comma-separated list of fields for `fielddata` index metric (supports wildcards)
|
17
|
+
# @option arguments [List] :fields A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)
|
18
|
+
# @option arguments [List] :groups A comma-separated list of search groups for `search` index metric
|
55
19
|
# @option arguments [String] :level Return stats aggregated at cluster, index or shard level
|
56
|
-
#
|
57
|
-
|
58
|
-
# @option arguments [
|
59
|
-
# @option arguments [
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
|
64
|
-
# @option arguments [Boolean] :
|
65
|
-
|
66
|
-
# @option arguments [List] :groups A comma-separated list of search groups to include in the `search` statistics
|
67
|
-
# @option arguments [Boolean] :suggest Return information about suggest statistics
|
68
|
-
# @option arguments [Boolean] :store Return information about the size of the index
|
69
|
-
# @option arguments [Boolean] :warmer Return information about warmers
|
70
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
71
|
-
# unavailable (missing, closed, etc)
|
72
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
73
|
-
# no concrete indices. (This includes `_all` string or when no
|
74
|
-
# indices have been specified)
|
75
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
|
76
|
-
# are open, closed or both. (options: open, closed)
|
77
|
-
#
|
78
|
-
# @option arguments [Boolean] :include_segment_file_sizes Whether to report the aggregated disk usage of each one of the Lucene index files. Only applies if segment stats are requested. (default: false)
|
20
|
+
# (options: cluster,indices,shards)
|
21
|
+
|
22
|
+
# @option arguments [List] :types A comma-separated list of document types for the `indexing` index metric
|
23
|
+
# @option arguments [Boolean] :include_segment_file_sizes Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)
|
24
|
+
# @option arguments [Boolean] :include_unloaded_segments If set to true segment stats will include stats for segments that are not currently loaded into memory
|
25
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
26
|
+
# (options: open,closed,none,all)
|
27
|
+
|
28
|
+
# @option arguments [Boolean] :forbid_closed_indices If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices
|
29
|
+
|
79
30
|
#
|
80
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
31
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-stats.html
|
81
32
|
#
|
82
|
-
def stats(arguments={})
|
33
|
+
def stats(arguments = {})
|
83
34
|
method = HTTP_GET
|
84
35
|
parts = Utils.__extract_parts arguments, ParamsRegistry.get(:stats_parts)
|
85
36
|
path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts)
|
86
|
-
|
87
37
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(:stats_params)
|
88
38
|
params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields]
|
89
39
|
params[:groups] = Utils.__listify(params[:groups], :escape => false) if params[:groups]
|
90
40
|
|
91
|
-
body
|
92
|
-
|
41
|
+
body = nil
|
93
42
|
perform_request(method, path, params, body).body
|
94
43
|
end
|
95
44
|
|
96
45
|
# Register this action with its valid params when the module is loaded.
|
97
46
|
#
|
98
|
-
# @since 6.
|
47
|
+
# @since 6.2.0
|
99
48
|
ParamsRegistry.register(:stats_params, [
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
:include_unloaded_segments,
|
112
|
-
:forbid_closed_indices ].freeze)
|
49
|
+
:completion_fields,
|
50
|
+
:fielddata_fields,
|
51
|
+
:fields,
|
52
|
+
:groups,
|
53
|
+
:level,
|
54
|
+
:types,
|
55
|
+
:include_segment_file_sizes,
|
56
|
+
:include_unloaded_segments,
|
57
|
+
:expand_wildcards,
|
58
|
+
:forbid_closed_indices
|
59
|
+
].freeze)
|
113
60
|
|
114
|
-
# Register this action with its valid parts when the module is loaded.
|
115
|
-
#
|
116
|
-
# @since 6.1.1
|
117
61
|
ParamsRegistry.register(:stats_parts, [
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
62
|
+
:_all,
|
63
|
+
:completion,
|
64
|
+
:docs,
|
65
|
+
:fielddata,
|
66
|
+
:query_cache,
|
67
|
+
:flush,
|
68
|
+
:get,
|
69
|
+
:indexing,
|
70
|
+
:merge,
|
71
|
+
:request_cache,
|
72
|
+
:refresh,
|
73
|
+
:search,
|
74
|
+
:segments,
|
75
|
+
:store,
|
76
|
+
:warmer,
|
77
|
+
:suggest,
|
78
|
+
:metric
|
79
|
+
].freeze)
|
80
|
+
end
|
131
81
|
end
|
132
|
-
end
|
133
82
|
end
|
134
83
|
end
|
@@ -2,7 +2,6 @@ module Elasticsearch
|
|
2
2
|
module API
|
3
3
|
module Indices
|
4
4
|
module Actions
|
5
|
-
|
6
5
|
# In order to keep indices available and queryable for a longer period but at the same time reduce their
|
7
6
|
# hardware requirements they can be transitioned into a frozen state. Once an index is frozen, all of its
|
8
7
|
# transient shard memory (aside from mappings and analyzers) is moved to persistent storage.
|
@@ -17,12 +16,13 @@ module Elasticsearch
|
|
17
16
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
18
17
|
|
19
18
|
valid_params = [
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
:timeout,
|
20
|
+
:master_timeout,
|
21
|
+
:ignore_unavailable,
|
22
|
+
:allow_no_indices,
|
23
|
+
:expand_wildcards,
|
24
|
+
:wait_for_active_shards
|
25
|
+
]
|
26
26
|
|
27
27
|
arguments = arguments.clone
|
28
28
|
index = arguments.delete(:index)
|
@@ -6,53 +6,36 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Perform multiple operation on index aliases in a single request.
|
11
|
-
#
|
12
|
-
# Pass the `actions` (add, remove) in the `body` argument.
|
13
|
-
#
|
14
|
-
# @example Add multiple indices to a single alias
|
15
|
-
#
|
16
|
-
# client.indices.update_aliases body: {
|
17
|
-
# actions: [
|
18
|
-
# { add: { index: 'logs-2013-06', alias: 'year-2013' } },
|
19
|
-
# { add: { index: 'logs-2013-05', alias: 'year-2013' } }
|
20
|
-
# ]
|
21
|
-
# }
|
9
|
+
# Updates index aliases.
|
22
10
|
#
|
23
|
-
# @example Swap an alias (atomic operation)
|
24
|
-
#
|
25
|
-
# client.indices.update_aliases body: {
|
26
|
-
# actions: [
|
27
|
-
# { remove: { index: 'logs-2013-06', alias: 'current-month' } },
|
28
|
-
# { add: { index: 'logs-2013-07', alias: 'current-month' } }
|
29
|
-
# ]
|
30
|
-
# }
|
31
|
-
#
|
32
|
-
# @option arguments [Hash] :body The definition of `actions` to perform (*Required*)
|
33
11
|
# @option arguments [Time] :timeout Request timeout
|
34
12
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
13
|
+
|
14
|
+
# @option arguments [Hash] :body The definition of `actions` to perform (*Required*)
|
35
15
|
#
|
36
|
-
# @see https://www.elastic.co/guide/reference/
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-aliases.html
|
37
17
|
#
|
38
|
-
def update_aliases(arguments={})
|
18
|
+
def update_aliases(arguments = {})
|
39
19
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
40
|
-
method = HTTP_POST
|
41
|
-
path = "_aliases"
|
42
20
|
|
21
|
+
arguments = arguments.clone
|
22
|
+
|
23
|
+
method = Elasticsearch::API::HTTP_POST
|
24
|
+
path = "_aliases"
|
43
25
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
44
|
-
body = arguments[:body]
|
45
26
|
|
27
|
+
body = arguments[:body]
|
46
28
|
perform_request(method, path, params, body).body
|
47
29
|
end
|
48
30
|
|
49
31
|
# Register this action with its valid params when the module is loaded.
|
50
32
|
#
|
51
|
-
# @since 6.
|
33
|
+
# @since 6.2.0
|
52
34
|
ParamsRegistry.register(:update_aliases, [
|
53
|
-
|
54
|
-
|
35
|
+
:timeout,
|
36
|
+
:master_timeout
|
37
|
+
].freeze)
|
38
|
+
end
|
55
39
|
end
|
56
|
-
end
|
57
40
|
end
|
58
41
|
end
|
@@ -6,38 +6,48 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Upgrade the index or indices to the latest Lucene format.
|
9
|
+
# The _upgrade API is no longer useful and will be removed.
|
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
12
|
# @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)
|
14
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
13
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
14
|
+
# (options: open,closed,none,all)
|
15
|
+
|
15
16
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
16
17
|
# @option arguments [Boolean] :wait_for_completion Specify whether the request should block until the all segments are upgraded (default: false)
|
17
18
|
# @option arguments [Boolean] :only_ancient_segments If true, only ancient (an older Lucene major release) segments will be upgraded
|
19
|
+
|
18
20
|
#
|
19
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
21
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-upgrade.html
|
20
22
|
#
|
21
|
-
def upgrade(arguments={})
|
22
|
-
|
23
|
-
|
23
|
+
def upgrade(arguments = {})
|
24
|
+
arguments = arguments.clone
|
25
|
+
|
26
|
+
_index = arguments.delete(:index)
|
27
|
+
|
28
|
+
method = Elasticsearch::API::HTTP_POST
|
29
|
+
path = if _index
|
30
|
+
"#{Utils.__listify(_index)}/_upgrade"
|
31
|
+
else
|
32
|
+
"_upgrade"
|
33
|
+
end
|
24
34
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
25
|
-
body = nil
|
26
35
|
|
36
|
+
body = nil
|
27
37
|
perform_request(method, path, params, body).body
|
28
38
|
end
|
29
39
|
|
30
40
|
# Register this action with its valid params when the module is loaded.
|
31
41
|
#
|
32
|
-
# @since 6.
|
42
|
+
# @since 6.2.0
|
33
43
|
ParamsRegistry.register(:upgrade, [
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
44
|
+
:allow_no_indices,
|
45
|
+
:expand_wildcards,
|
46
|
+
:ignore_unavailable,
|
47
|
+
:wait_for_completion,
|
48
|
+
:only_ancient_segments
|
49
|
+
].freeze)
|
50
|
+
end
|
40
51
|
end
|
41
|
-
end
|
42
52
|
end
|
43
53
|
end
|
@@ -6,88 +6,75 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Validate a query
|
11
|
-
#
|
12
|
-
# @example Validate a simple query string query
|
13
|
-
#
|
14
|
-
# client.indices.validate_query index: 'myindex', q: 'title:foo AND body:bar'
|
15
|
-
#
|
16
|
-
# @example Validate an invalid query (with explanation)
|
17
|
-
#
|
18
|
-
# client.indices.validate_query index: 'myindex', q: '[[[ BOOM! ]]]', explain: true
|
19
|
-
#
|
20
|
-
# @example Validate a DSL query (with explanation and rewrite). With rewrite set to true, the
|
21
|
-
# explanation is more detailed showing the actual Lucene query that will
|
22
|
-
# be executed.
|
23
|
-
#
|
24
|
-
# client.indices.validate_query index: 'myindex',
|
25
|
-
# rewrite: true,
|
26
|
-
# explain: true,
|
27
|
-
# body: {
|
28
|
-
# filtered: {
|
29
|
-
# query: {
|
30
|
-
# match: {
|
31
|
-
# title: 'foo'
|
32
|
-
# }
|
33
|
-
# },
|
34
|
-
# filter: {
|
35
|
-
# range: {
|
36
|
-
# published_at: {
|
37
|
-
# from: '2013-06-01'
|
38
|
-
# }
|
39
|
-
# }
|
40
|
-
# }
|
41
|
-
# }
|
42
|
-
# }
|
9
|
+
# Allows a user to validate a potentially expensive query without executing it.
|
43
10
|
#
|
44
11
|
# @option arguments [List] :index A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices
|
45
|
-
# @option arguments [List] :type A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types
|
46
|
-
# @option arguments [Hash] :body The query definition specified with the Query DSL
|
12
|
+
# @option arguments [List] :type A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types *Deprecated*
|
47
13
|
# @option arguments [Boolean] :explain Return detailed information about the error
|
48
14
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
49
15
|
# @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)
|
50
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
16
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
17
|
+
# (options: open,closed,none,all)
|
18
|
+
|
51
19
|
# @option arguments [String] :q Query in the Lucene query string syntax
|
52
20
|
# @option arguments [String] :analyzer The analyzer to use for the query string
|
53
21
|
# @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false)
|
54
|
-
# @option arguments [String] :default_operator The default operator for query string query (AND or OR)
|
22
|
+
# @option arguments [String] :default_operator The default operator for query string query (AND or OR)
|
23
|
+
# (options: AND,OR)
|
24
|
+
|
55
25
|
# @option arguments [String] :df The field to use as default where no field prefix is given in the query string
|
56
26
|
# @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
|
57
27
|
# @option arguments [Boolean] :rewrite Provide a more detailed explanation showing the actual Lucene query that will be executed.
|
58
28
|
# @option arguments [Boolean] :all_shards Execute validation on all shards instead of one random shard per index
|
29
|
+
|
30
|
+
# @option arguments [Hash] :body The query definition specified with the Query DSL
|
31
|
+
#
|
32
|
+
# *Deprecation notice*:
|
33
|
+
# Specifying types in urls has been deprecated
|
34
|
+
# Deprecated since version 7.0.0
|
35
|
+
#
|
59
36
|
#
|
60
|
-
# @see https://www.elastic.co/guide/reference/
|
37
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-validate.html
|
61
38
|
#
|
62
|
-
def validate_query(arguments={})
|
63
|
-
|
64
|
-
path = Utils.__pathify Utils.__listify(arguments[:index]),
|
65
|
-
Utils.__listify(arguments[:type]),
|
66
|
-
'_validate/query'
|
39
|
+
def validate_query(arguments = {})
|
40
|
+
arguments = arguments.clone
|
67
41
|
|
42
|
+
_index = arguments.delete(:index)
|
43
|
+
|
44
|
+
_type = arguments.delete(:type)
|
45
|
+
|
46
|
+
method = Elasticsearch::API::HTTP_GET
|
47
|
+
path = if _index && _type
|
48
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_validate/query"
|
49
|
+
elsif _index
|
50
|
+
"#{Utils.__listify(_index)}/_validate/query"
|
51
|
+
else
|
52
|
+
"_validate/query"
|
53
|
+
end
|
68
54
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
69
|
-
body = arguments[:body]
|
70
55
|
|
56
|
+
body = arguments[:body]
|
71
57
|
perform_request(method, path, params, body).body
|
72
58
|
end
|
73
59
|
|
74
60
|
# Register this action with its valid params when the module is loaded.
|
75
61
|
#
|
76
|
-
# @since 6.
|
62
|
+
# @since 6.2.0
|
77
63
|
ParamsRegistry.register(:validate_query, [
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
64
|
+
:explain,
|
65
|
+
:ignore_unavailable,
|
66
|
+
:allow_no_indices,
|
67
|
+
:expand_wildcards,
|
68
|
+
:q,
|
69
|
+
:analyzer,
|
70
|
+
:analyze_wildcard,
|
71
|
+
:default_operator,
|
72
|
+
:df,
|
73
|
+
:lenient,
|
74
|
+
:rewrite,
|
75
|
+
:all_shards
|
76
|
+
].freeze)
|
77
|
+
end
|
90
78
|
end
|
91
|
-
end
|
92
79
|
end
|
93
80
|
end
|
@@ -5,19 +5,22 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
+
# Returns basic information about the cluster.
|
9
|
+
#
|
8
10
|
|
9
|
-
# Return simple information about the cluster (name, version).
|
10
11
|
#
|
11
|
-
# @see
|
12
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/index.html
|
12
13
|
#
|
13
|
-
def info(arguments={})
|
14
|
-
|
14
|
+
def info(arguments = {})
|
15
|
+
arguments = arguments.clone
|
16
|
+
|
17
|
+
method = Elasticsearch::API::HTTP_GET
|
15
18
|
path = ""
|
16
19
|
params = {}
|
17
|
-
body = nil
|
18
20
|
|
21
|
+
body = nil
|
19
22
|
perform_request(method, path, params, body).body
|
20
23
|
end
|
21
24
|
end
|
22
|
-
|
25
|
+
end
|
23
26
|
end
|