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
@@ -1,22 +1,42 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V under one or more agreements.
|
2
|
+
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
3
|
+
# See the LICENSE file in the project root for more information
|
4
|
+
|
1
5
|
module Elasticsearch
|
2
6
|
module API
|
3
7
|
module Nodes
|
4
8
|
module Actions
|
5
|
-
|
6
|
-
# The cluster nodes usage API allows to retrieve information on the usage of features for each node.
|
9
|
+
# Returns low-level information about REST actions usage on nodes.
|
7
10
|
#
|
8
|
-
# @option arguments [List] :metric Limit the information returned to the specified metrics (options: _all,rest_actions)
|
9
11
|
# @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
|
12
|
+
# @option arguments [List] :metric Limit the information returned to the specified metrics
|
13
|
+
# (options: _all,rest_actions)
|
14
|
+
|
10
15
|
# @option arguments [Time] :timeout Explicit operation timeout
|
16
|
+
|
11
17
|
#
|
12
|
-
# @see
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cluster-nodes-usage.html
|
13
19
|
#
|
14
|
-
def usage(arguments={})
|
20
|
+
def usage(arguments = {})
|
21
|
+
arguments = arguments.clone
|
22
|
+
|
23
|
+
_node_id = arguments.delete(:node_id)
|
24
|
+
|
25
|
+
_metric = arguments.delete(:metric)
|
26
|
+
|
15
27
|
method = Elasticsearch::API::HTTP_GET
|
16
|
-
path =
|
17
|
-
|
18
|
-
|
28
|
+
path = if _node_id && _metric
|
29
|
+
"_nodes/#{Utils.__listify(_node_id)}/usage/#{Utils.__listify(_metric)}"
|
30
|
+
elsif _node_id
|
31
|
+
"_nodes/#{Utils.__listify(_node_id)}/usage"
|
32
|
+
elsif _metric
|
33
|
+
"_nodes/usage/#{Utils.__listify(_metric)}"
|
34
|
+
else
|
35
|
+
"_nodes/usage"
|
36
|
+
end
|
37
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
19
38
|
|
39
|
+
body = nil
|
20
40
|
perform_request(method, path, params, body).body
|
21
41
|
end
|
22
42
|
|
@@ -24,8 +44,9 @@ module Elasticsearch
|
|
24
44
|
#
|
25
45
|
# @since 6.2.0
|
26
46
|
ParamsRegistry.register(:usage, [
|
27
|
-
|
47
|
+
:timeout
|
48
|
+
].freeze)
|
49
|
+
end
|
28
50
|
end
|
29
|
-
end
|
30
51
|
end
|
31
52
|
end
|
@@ -5,31 +5,30 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# Returns true if the cluster returns a successful HTTP response, false otherwise.
|
10
|
-
#
|
11
|
-
# @example
|
8
|
+
# Returns whether the cluster is running.
|
12
9
|
#
|
13
|
-
|
10
|
+
|
14
11
|
#
|
15
|
-
# @see
|
12
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/index.html
|
16
13
|
#
|
17
|
-
def ping(arguments={})
|
18
|
-
|
14
|
+
def ping(arguments = {})
|
15
|
+
arguments = arguments.clone
|
16
|
+
|
17
|
+
method = Elasticsearch::API::HTTP_HEAD
|
19
18
|
path = ""
|
20
19
|
params = {}
|
21
|
-
body = nil
|
22
20
|
|
21
|
+
body = nil
|
23
22
|
begin
|
24
|
-
|
23
|
+
perform_request(method, path, params, body).status == 200 ? true : false
|
25
24
|
rescue Exception => e
|
26
|
-
if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not
|
25
|
+
if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not *Found|404|ConnectionFailed/i
|
27
26
|
false
|
28
27
|
else
|
29
28
|
raise e
|
30
29
|
end
|
31
|
-
end
|
32
30
|
end
|
31
|
+
end
|
32
|
+
end
|
33
33
|
end
|
34
|
-
end
|
35
34
|
end
|
@@ -5,52 +5,48 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# Store a script in an internal index (`.scripts`), to be able to reference them
|
10
|
-
# in search definitions (with dynamic scripting disabled)
|
11
|
-
#
|
12
|
-
# @example Storing an Mvel script in Elasticsearch and using it in function score
|
13
|
-
#
|
14
|
-
# client.put_script id: 'my_score', body: { script: { lang: 'groovy', source: 'log(_score * factor)' } }
|
15
|
-
#
|
16
|
-
# client.search body: {
|
17
|
-
# query: {
|
18
|
-
# function_score: {
|
19
|
-
# query: { match: { title: 'foo' } },
|
20
|
-
# functions: [ { script_score: { script_id: 'my_score', params: { factor: 3 } } } ]
|
21
|
-
# }
|
22
|
-
# }
|
23
|
-
# }
|
8
|
+
# Creates or updates a script.
|
24
9
|
#
|
25
|
-
# @option arguments [String] :id Script ID
|
10
|
+
# @option arguments [String] :id Script ID
|
26
11
|
# @option arguments [String] :context Script context
|
27
|
-
# @option arguments [Hash] :body The document (*Required*)
|
28
12
|
# @option arguments [Time] :timeout Explicit operation timeout
|
29
13
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
30
14
|
# @option arguments [String] :context Context name to compile script against
|
15
|
+
|
16
|
+
# @option arguments [Hash] :body The document (*Required*)
|
31
17
|
#
|
32
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-scripting.html
|
33
19
|
#
|
34
|
-
def put_script(arguments={})
|
35
|
-
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
20
|
+
def put_script(arguments = {})
|
36
21
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
37
|
-
|
38
|
-
path = "_scripts/#{arguments.has_key?(:lang) ? "#{arguments.delete(:lang)}/" : ''}#{arguments[:id]}"
|
22
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
39
23
|
|
40
|
-
|
24
|
+
arguments = arguments.clone
|
25
|
+
|
26
|
+
_id = arguments.delete(:id)
|
41
27
|
|
42
|
-
|
28
|
+
_context = arguments.delete(:context)
|
43
29
|
|
30
|
+
method = Elasticsearch::API::HTTP_PUT
|
31
|
+
path = if _id && _context
|
32
|
+
"_scripts/#{Utils.__listify(_id)}/#{Utils.__listify(_context)}"
|
33
|
+
else
|
34
|
+
"_scripts/#{Utils.__listify(_id)}"
|
35
|
+
end
|
36
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
37
|
+
|
38
|
+
body = arguments[:body]
|
44
39
|
perform_request(method, path, params, body).body
|
45
40
|
end
|
46
41
|
|
47
42
|
# Register this action with its valid params when the module is loaded.
|
48
43
|
#
|
49
|
-
# @since 6.
|
44
|
+
# @since 6.2.0
|
50
45
|
ParamsRegistry.register(:put_script, [
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
:timeout,
|
47
|
+
:master_timeout,
|
48
|
+
:context
|
49
|
+
].freeze)
|
50
|
+
end
|
54
51
|
end
|
55
|
-
end
|
56
52
|
end
|
@@ -5,26 +5,34 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# The ranking evaluation API allows to evaluate the quality of ranked search results over a set of typical search queries.
|
10
|
-
# Given this set of queries and a list of manually rated documents, the _rank_eval endpoint calculates and
|
11
|
-
# returns typical information retrieval metrics like mean reciprocal rank, precision or discounted cumulative gain.
|
8
|
+
# Allows to evaluate the quality of ranked search results over a set of typical search queries
|
12
9
|
#
|
13
10
|
# @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|
14
|
-
# @option arguments [Hash] :body The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. (*Required*)
|
15
11
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
16
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)
|
17
|
-
# @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
|
+
|
16
|
+
# @option arguments [Hash] :body The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. (*Required*)
|
18
17
|
#
|
19
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-rank-eval.html
|
20
19
|
#
|
21
|
-
def rank_eval(arguments={})
|
20
|
+
def rank_eval(arguments = {})
|
22
21
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
22
|
+
|
23
|
+
arguments = arguments.clone
|
24
|
+
|
25
|
+
_index = arguments.delete(:index)
|
26
|
+
|
23
27
|
method = Elasticsearch::API::HTTP_GET
|
24
|
-
path =
|
25
|
-
|
26
|
-
|
28
|
+
path = if _index
|
29
|
+
"#{Utils.__listify(_index)}/_rank_eval"
|
30
|
+
else
|
31
|
+
"_rank_eval"
|
32
|
+
end
|
33
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
27
34
|
|
35
|
+
body = arguments[:body]
|
28
36
|
perform_request(method, path, params, body).body
|
29
37
|
end
|
30
38
|
|
@@ -32,9 +40,10 @@ module Elasticsearch
|
|
32
40
|
#
|
33
41
|
# @since 6.2.0
|
34
42
|
ParamsRegistry.register(:rank_eval, [
|
35
|
-
|
36
|
-
|
37
|
-
|
43
|
+
:ignore_unavailable,
|
44
|
+
:allow_no_indices,
|
45
|
+
:expand_wildcards
|
46
|
+
].freeze)
|
47
|
+
end
|
38
48
|
end
|
39
|
-
end
|
40
49
|
end
|
@@ -5,72 +5,49 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# @example Copy documents into a different index
|
13
|
-
#
|
14
|
-
# client.reindex body: { source: { index: 'test1' }, dest: { index: 'test2' } }
|
15
|
-
#
|
16
|
-
# @example Limit the copied documents with a query
|
17
|
-
#
|
18
|
-
# client.reindex body: {
|
19
|
-
# source: {
|
20
|
-
# index: 'test1',
|
21
|
-
# query: { terms: { category: ['one', 'two'] } }
|
22
|
-
# },
|
23
|
-
# dest: {
|
24
|
-
# index: 'test2'
|
25
|
-
# }
|
26
|
-
# }
|
27
|
-
#
|
28
|
-
# @example Remove a field from reindexed documents
|
29
|
-
#
|
30
|
-
# client.reindex body: {
|
31
|
-
# source: {
|
32
|
-
# index: 'test1'
|
33
|
-
# },
|
34
|
-
# dest: {
|
35
|
-
# index: 'test3'
|
36
|
-
# },
|
37
|
-
# script: {
|
38
|
-
# inline: 'ctx._source.remove("category")'
|
39
|
-
# }
|
40
|
-
# }
|
8
|
+
# Allows to copy documents from one index to another, optionally filtering the source
|
9
|
+
# documents by a query, changing the destination index settings, or fetching the
|
10
|
+
# documents from a remote cluster.
|
41
11
|
#
|
42
|
-
# @option arguments [
|
43
|
-
# @option arguments [Boolean] :refresh Should the effected indexes be refreshed?
|
12
|
+
# @option arguments [Boolean] :refresh Should the affected indexes be refreshed?
|
44
13
|
# @option arguments [Time] :timeout Time each individual bulk request should wait for shards that are unavailable.
|
45
14
|
# @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
46
15
|
# @option arguments [Boolean] :wait_for_completion Should the request should block until the reindex is complete.
|
47
16
|
# @option arguments [Number] :requests_per_second The throttle to set on this request in sub-requests per second. -1 means no throttle.
|
48
17
|
# @option arguments [Time] :scroll Control how long to keep the search context alive
|
49
18
|
# @option arguments [Number] :slices The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
|
19
|
+
# @option arguments [Number] :max_docs Maximum number of documents to process (default: all documents)
|
20
|
+
|
21
|
+
# @option arguments [Hash] :body The search definition using the Query DSL and the prototype for the index request. (*Required*)
|
50
22
|
#
|
51
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
23
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-reindex.html
|
52
24
|
#
|
53
|
-
def reindex(arguments={})
|
25
|
+
def reindex(arguments = {})
|
54
26
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
55
|
-
|
27
|
+
|
28
|
+
arguments = arguments.clone
|
29
|
+
|
30
|
+
method = Elasticsearch::API::HTTP_POST
|
56
31
|
path = "_reindex"
|
57
32
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
58
|
-
body = arguments[:body]
|
59
33
|
|
34
|
+
body = arguments[:body]
|
60
35
|
perform_request(method, path, params, body).body
|
61
36
|
end
|
62
37
|
|
63
38
|
# Register this action with its valid params when the module is loaded.
|
64
39
|
#
|
65
|
-
# @since 6.
|
40
|
+
# @since 6.2.0
|
66
41
|
ParamsRegistry.register(:reindex, [
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
42
|
+
:refresh,
|
43
|
+
:timeout,
|
44
|
+
:wait_for_active_shards,
|
45
|
+
:wait_for_completion,
|
46
|
+
:requests_per_second,
|
47
|
+
:scroll,
|
48
|
+
:slices,
|
49
|
+
:max_docs
|
50
|
+
].freeze)
|
51
|
+
end
|
74
52
|
end
|
75
|
-
end
|
76
53
|
end
|
@@ -5,21 +5,26 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# The value of requests_per_second can be changed on a running reindex using the _rethrottle
|
8
|
+
# Changes the number of requests per second for a particular Reindex operation.
|
10
9
|
#
|
11
|
-
# @option arguments [String] :task_id The task id to rethrottle
|
12
|
-
# @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
|
10
|
+
# @option arguments [String] :task_id The task id to rethrottle
|
11
|
+
# @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (*Required*)
|
12
|
+
|
13
13
|
#
|
14
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
14
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-reindex.html
|
15
15
|
#
|
16
|
-
def reindex_rethrottle(arguments={})
|
16
|
+
def reindex_rethrottle(arguments = {})
|
17
17
|
raise ArgumentError, "Required argument 'task_id' missing" unless arguments[:task_id]
|
18
|
+
|
19
|
+
arguments = arguments.clone
|
20
|
+
|
21
|
+
_task_id = arguments.delete(:task_id)
|
22
|
+
|
18
23
|
method = Elasticsearch::API::HTTP_POST
|
19
|
-
path = "_reindex/#{
|
20
|
-
params =
|
21
|
-
body = nil
|
24
|
+
path = "_reindex/#{Utils.__listify(_task_id)}/_rethrottle"
|
25
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
22
26
|
|
27
|
+
body = nil
|
23
28
|
perform_request(method, path, params, body).body
|
24
29
|
end
|
25
30
|
|
@@ -27,7 +32,8 @@ module Elasticsearch
|
|
27
32
|
#
|
28
33
|
# @since 6.2.0
|
29
34
|
ParamsRegistry.register(:reindex_rethrottle, [
|
30
|
-
|
35
|
+
:requests_per_second
|
36
|
+
].freeze)
|
37
|
+
end
|
31
38
|
end
|
32
|
-
|
33
|
-
end
|
39
|
+
end
|
@@ -6,12 +6,11 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Remote
|
8
8
|
module Actions
|
9
|
-
|
10
9
|
# Returns all of the configured remote cluster information
|
11
10
|
#
|
12
11
|
# @see http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html
|
13
12
|
#
|
14
|
-
def info(arguments={})
|
13
|
+
def info(arguments = {})
|
15
14
|
method = HTTP_GET
|
16
15
|
path = "_remote/info"
|
17
16
|
params = {}
|
@@ -5,28 +5,30 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# Pre-render search requests before they are executed and fill existing templates with template parameters
|
8
|
+
# Allows to use the Mustache language to pre-render a search definition.
|
10
9
|
#
|
11
10
|
# @option arguments [String] :id The id of the stored search template
|
11
|
+
|
12
12
|
# @option arguments [Hash] :body The search definition template and its params
|
13
13
|
#
|
14
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
14
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-template.html#_validating_templates
|
15
15
|
#
|
16
|
-
def render_search_template(arguments={})
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
def render_search_template(arguments = {})
|
17
|
+
arguments = arguments.clone
|
18
|
+
|
19
|
+
_id = arguments.delete(:id)
|
20
|
+
|
21
|
+
method = Elasticsearch::API::HTTP_GET
|
22
|
+
path = if _id
|
23
|
+
"_render/template/#{Utils.__listify(_id)}"
|
24
|
+
else
|
25
|
+
"_render/template"
|
26
|
+
end
|
27
|
+
params = {}
|
21
28
|
|
29
|
+
body = arguments[:body]
|
22
30
|
perform_request(method, path, params, body).body
|
23
31
|
end
|
24
|
-
|
25
|
-
# Register this action with its valid params when the module is loaded.
|
26
|
-
#
|
27
|
-
# @since 6.1.1
|
28
|
-
ParamsRegistry.register(:render_search_template, [
|
29
|
-
:id ].freeze)
|
30
32
|
end
|
31
|
-
|
33
|
+
end
|
32
34
|
end
|