elasticsearch-api 6.2.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -1
- data/lib/elasticsearch/api/actions/benchmark.rb +1 -1
- data/lib/elasticsearch/api/actions/bulk.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/aliases.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/allocation.rb +11 -11
- data/lib/elasticsearch/api/actions/cat/count.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +9 -7
- data/lib/elasticsearch/api/actions/cat/health.rb +11 -11
- data/lib/elasticsearch/api/actions/cat/help.rb +4 -2
- data/lib/elasticsearch/api/actions/cat/indices.rb +14 -15
- data/lib/elasticsearch/api/actions/cat/master.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +6 -4
- data/lib/elasticsearch/api/actions/cat/nodes.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/plugins.rb +7 -6
- data/lib/elasticsearch/api/actions/cat/recovery.rb +10 -12
- data/lib/elasticsearch/api/actions/cat/repositories.rb +7 -3
- data/lib/elasticsearch/api/actions/cat/segments.rb +9 -7
- data/lib/elasticsearch/api/actions/cat/shards.rb +12 -12
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +8 -4
- data/lib/elasticsearch/api/actions/cat/tasks.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/templates.rb +6 -6
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +13 -17
- data/lib/elasticsearch/api/actions/clear_scroll.rb +7 -0
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +2 -3
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +5 -2
- data/lib/elasticsearch/api/actions/cluster/health.rb +11 -20
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +2 -3
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +8 -3
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +7 -1
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +7 -7
- data/lib/elasticsearch/api/actions/cluster/state.rb +18 -15
- data/lib/elasticsearch/api/actions/cluster/stats.rb +12 -5
- data/lib/elasticsearch/api/actions/count.rb +12 -23
- data/lib/elasticsearch/api/actions/count_percolate.rb +1 -1
- data/lib/elasticsearch/api/actions/delete.rb +16 -8
- data/lib/elasticsearch/api/actions/delete_by_query.rb +7 -9
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +29 -0
- data/lib/elasticsearch/api/actions/delete_script.rb +5 -6
- data/lib/elasticsearch/api/actions/exists.rb +3 -4
- data/lib/elasticsearch/api/actions/exists_source.rb +51 -0
- data/lib/elasticsearch/api/actions/explain.rb +11 -25
- data/lib/elasticsearch/api/actions/field_caps.rb +2 -2
- data/lib/elasticsearch/api/actions/get.rb +13 -19
- data/lib/elasticsearch/api/actions/get_script.rb +9 -2
- data/lib/elasticsearch/api/actions/get_source.rb +10 -14
- data/lib/elasticsearch/api/actions/index.rb +10 -16
- data/lib/elasticsearch/api/actions/indices/analyze.rb +3 -27
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +2 -4
- data/lib/elasticsearch/api/actions/indices/close.rb +9 -15
- data/lib/elasticsearch/api/actions/indices/create.rb +7 -7
- data/lib/elasticsearch/api/actions/indices/delete.rb +3 -4
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +7 -4
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +5 -2
- data/lib/elasticsearch/api/actions/indices/exists.rb +11 -17
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +8 -4
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +6 -15
- data/lib/elasticsearch/api/actions/indices/flush.rb +5 -9
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +13 -11
- data/lib/elasticsearch/api/actions/indices/freeze.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/get.rb +9 -15
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +11 -15
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +12 -16
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +12 -21
- data/lib/elasticsearch/api/actions/indices/get_template.rb +8 -5
- data/lib/elasticsearch/api/actions/indices/open.rb +9 -15
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +6 -3
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -23
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +10 -20
- data/lib/elasticsearch/api/actions/indices/put_template.rb +10 -5
- data/lib/elasticsearch/api/actions/indices/recovery.rb +2 -4
- data/lib/elasticsearch/api/actions/indices/refresh.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/rollover.rb +6 -5
- data/lib/elasticsearch/api/actions/indices/segments.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +2 -4
- data/lib/elasticsearch/api/actions/indices/shrink.rb +6 -7
- data/lib/elasticsearch/api/actions/indices/split.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +7 -4
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +10 -13
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +14 -25
- data/lib/elasticsearch/api/actions/info.rb +6 -0
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +1 -1
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +4 -3
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +29 -0
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +1 -1
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +5 -5
- data/lib/elasticsearch/api/actions/mget.rb +8 -17
- data/lib/elasticsearch/api/actions/msearch.rb +7 -2
- data/lib/elasticsearch/api/actions/msearch_template.rb +8 -1
- data/lib/elasticsearch/api/actions/mtermvectors.rb +21 -22
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +4 -6
- data/lib/elasticsearch/api/actions/nodes/info.rb +6 -26
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +10 -4
- data/lib/elasticsearch/api/actions/nodes/stats.rb +11 -30
- data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -0
- data/lib/elasticsearch/api/actions/ping.rb +6 -0
- data/lib/elasticsearch/api/actions/put_script.rb +10 -9
- data/lib/elasticsearch/api/actions/rank_eval.rb +36 -0
- data/lib/elasticsearch/api/actions/reindex.rb +9 -14
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +29 -0
- data/lib/elasticsearch/api/actions/render_search_template.rb +1 -1
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +27 -0
- data/lib/elasticsearch/api/actions/scroll.rb +3 -2
- data/lib/elasticsearch/api/actions/search.rb +36 -53
- data/lib/elasticsearch/api/actions/search_shards.rb +7 -14
- data/lib/elasticsearch/api/actions/search_template.rb +20 -19
- data/lib/elasticsearch/api/actions/snapshot/create.rb +2 -3
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +4 -3
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +3 -3
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +1 -2
- data/lib/elasticsearch/api/actions/snapshot/get.rb +3 -3
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +3 -6
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/status.rb +4 -5
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +1 -2
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +7 -13
- data/lib/elasticsearch/api/actions/tasks/get.rb +6 -3
- data/lib/elasticsearch/api/actions/tasks/list.rb +10 -16
- data/lib/elasticsearch/api/actions/termvectors.rb +22 -21
- data/lib/elasticsearch/api/actions/update.rb +19 -33
- data/lib/elasticsearch/api/actions/update_by_query.rb +13 -33
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +29 -0
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/actions/cluster/state_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +17 -0
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -37
- data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/indices/segments_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/mget_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/mlt_spec.rb +127 -114
- data/spec/elasticsearch/api/actions/search_exists_spec.rb +58 -12
- data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
- data/test/integration/yaml_test_runner.rb +2 -4
- data/utils/thor/generate_source.rb +1 -0
- data/utils/thor/templates/ruby/method.erb +7 -5
- metadata +12 -10
- data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +0 -68
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +0 -68
|
@@ -33,34 +33,24 @@ module Elasticsearch
|
|
|
33
33
|
# body: { script: 'ctx._source.tags.contains(params.tag) ? ctx.op = "delete" : ctx.op = "none"',
|
|
34
34
|
# params: { tag: 'to-delete' } }
|
|
35
35
|
#
|
|
36
|
+
#
|
|
36
37
|
# @option arguments [String] :id Document ID (*Required*)
|
|
37
|
-
# @option arguments [Number,List] :ignore The list of HTTP errors to ignore; only `404` supported at the moment
|
|
38
38
|
# @option arguments [String] :index The name of the index (*Required*)
|
|
39
39
|
# @option arguments [String] :type The type of the document (*Required*)
|
|
40
|
-
# @option arguments [Hash] :body The request definition
|
|
41
|
-
# @option arguments [String] :
|
|
42
|
-
# (options: one, quorum, all)
|
|
40
|
+
# @option arguments [Hash] :body The request definition requires either `script` or partial `doc` (*Required*)
|
|
41
|
+
# @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the update 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)
|
|
43
42
|
# @option arguments [List] :fields A comma-separated list of fields to return in the response
|
|
44
|
-
# @option arguments [
|
|
45
|
-
# @option arguments [
|
|
46
|
-
# @option arguments [
|
|
47
|
-
#
|
|
48
|
-
# @option arguments [
|
|
49
|
-
# @option arguments [String] :
|
|
50
|
-
# @option arguments [Number] :retry_on_conflict Specify how many times should the operation be retried
|
|
51
|
-
# when a conflict occurs (default: 0)
|
|
43
|
+
# @option arguments [List] :_source True or false to return the _source field or not, or a list of fields to return
|
|
44
|
+
# @option arguments [List] :_source_excludes A list of fields to exclude from the returned _source field
|
|
45
|
+
# @option arguments [List] :_source_includes A list of fields to extract and return from the _source field
|
|
46
|
+
# @option arguments [String] :lang The script language (default: painless)
|
|
47
|
+
# @option arguments [String] :parent ID of the parent document. Is is only used for routing and when for the upsert request
|
|
48
|
+
# @option arguments [String] :refresh If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (options: true, false, wait_for)
|
|
49
|
+
# @option arguments [Number] :retry_on_conflict Specify how many times should the operation be retried when a conflict occurs (default: 0)
|
|
52
50
|
# @option arguments [String] :routing Specific routing value
|
|
53
|
-
# @option arguments [String] :script The URL-encoded script definition (instead of using request body)
|
|
54
|
-
# @option arguments [String] :_source Specify whether the _source field should be returned,
|
|
55
|
-
# or a list of fields to return
|
|
56
|
-
# @option arguments [String] :_source_exclude A list of fields to exclude from the returned _source field
|
|
57
|
-
# @option arguments [String] :_source_include A list of fields to extract and return from the _source field
|
|
58
51
|
# @option arguments [Time] :timeout Explicit operation timeout
|
|
59
|
-
# @option arguments [Time] :timestamp Explicit timestamp for the document
|
|
60
|
-
# @option arguments [Duration] :ttl Expiration time for the document
|
|
61
52
|
# @option arguments [Number] :version Explicit version number for concurrency control
|
|
62
|
-
# @option arguments [
|
|
63
|
-
#
|
|
53
|
+
# @option arguments [String] :version_type Specific version type (options: internal, force)
|
|
64
54
|
# @since 0.20
|
|
65
55
|
#
|
|
66
56
|
# @see http://elasticsearch.org/guide/reference/api/update/
|
|
@@ -91,26 +81,22 @@ module Elasticsearch
|
|
|
91
81
|
#
|
|
92
82
|
# @since 6.2.0
|
|
93
83
|
ParamsRegistry.register(:update, [
|
|
94
|
-
:
|
|
84
|
+
:wait_for_active_shards,
|
|
95
85
|
:fields,
|
|
86
|
+
:_source,
|
|
87
|
+
:_source_excludes,
|
|
88
|
+
:_source_includes,
|
|
96
89
|
:lang,
|
|
97
90
|
:parent,
|
|
98
|
-
:percolate,
|
|
99
91
|
:refresh,
|
|
100
|
-
:replication,
|
|
101
92
|
:retry_on_conflict,
|
|
102
93
|
:routing,
|
|
103
|
-
:script,
|
|
104
|
-
:_source,
|
|
105
|
-
:_source_include,
|
|
106
|
-
:_source_includes,
|
|
107
|
-
:_source_exclude,
|
|
108
|
-
:_source_excludes,
|
|
109
94
|
:timeout,
|
|
110
|
-
:timestamp,
|
|
111
|
-
:ttl,
|
|
112
95
|
:version,
|
|
113
|
-
:version_type
|
|
96
|
+
:version_type,
|
|
97
|
+
:if_seq_no,
|
|
98
|
+
:include_type_name,
|
|
99
|
+
:if_primary_term ].freeze)
|
|
114
100
|
end
|
|
115
101
|
end
|
|
116
102
|
end
|
|
@@ -23,47 +23,38 @@ module Elasticsearch
|
|
|
23
23
|
# @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false)
|
|
24
24
|
# @option arguments [String] :default_operator The default operator for query string query (AND or OR) (options: AND, OR)
|
|
25
25
|
# @option arguments [String] :df The field to use as default where no field prefix is given in the query string
|
|
26
|
-
# @option arguments [Boolean] :explain Specify whether to return detailed information about score computation as part of a hit
|
|
27
|
-
# @option arguments [List] :fields A comma-separated list of fields to return as part of a hit
|
|
28
|
-
# @option arguments [List] :fielddata_fields A comma-separated list of fields to return as the field data representation of a field for each hit
|
|
29
26
|
# @option arguments [Number] :from Starting offset (default: 0)
|
|
30
27
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
|
31
28
|
# @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)
|
|
32
|
-
# @option arguments [String] :conflicts What to do when the
|
|
29
|
+
# @option arguments [String] :conflicts What to do when the update by query hits version conflicts? (options: abort, proceed)
|
|
33
30
|
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
|
|
34
31
|
# @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
|
|
35
|
-
# @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
|
|
36
32
|
# @option arguments [String] :pipeline Ingest pipeline to set on index requests made by this action. (default: none)
|
|
37
33
|
# @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
|
|
38
34
|
# @option arguments [String] :q Query in the Lucene query string syntax
|
|
39
35
|
# @option arguments [List] :routing A comma-separated list of specific routing values
|
|
40
|
-
# @option arguments [
|
|
36
|
+
# @option arguments [Time] :scroll Specify how long a consistent view of the index should be maintained for scrolled search
|
|
41
37
|
# @option arguments [String] :search_type Search operation type (options: query_then_fetch, dfs_query_then_fetch)
|
|
42
38
|
# @option arguments [Time] :search_timeout Explicit timeout for each search request. Defaults to no timeout.
|
|
43
39
|
# @option arguments [Number] :size Number of hits to return (default: 10)
|
|
44
40
|
# @option arguments [List] :sort A comma-separated list of <field>:<direction> pairs
|
|
45
41
|
# @option arguments [List] :_source True or false to return the _source field or not, or a list of fields to return
|
|
46
|
-
# @option arguments [List] :
|
|
47
|
-
# @option arguments [List] :
|
|
42
|
+
# @option arguments [List] :_source_excludes A list of fields to exclude from the returned _source field
|
|
43
|
+
# @option arguments [List] :_source_includes A list of fields to extract and return from the _source field
|
|
48
44
|
# @option arguments [Number] :terminate_after The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
|
|
49
45
|
# @option arguments [List] :stats Specific 'tag' of the request for logging and statistical purposes
|
|
50
|
-
# @option arguments [String] :suggest_field Specify which field to use for suggestions
|
|
51
|
-
# @option arguments [String] :suggest_mode Specify suggest mode (options: missing, popular, always)
|
|
52
|
-
# @option arguments [Number] :suggest_size How many suggestions to return in response
|
|
53
|
-
# @option arguments [Text] :suggest_text The source text for which the suggestions should be returned
|
|
54
|
-
# @option arguments [Time] :timeout Time each individual bulk request should wait for shards that are unavailable.
|
|
55
|
-
# @option arguments [Boolean] :track_scores Whether to calculate and return scores even if they are not used for sorting
|
|
56
46
|
# @option arguments [Boolean] :version Specify whether to return document version as part of a hit
|
|
57
47
|
# @option arguments [Boolean] :version_type Should the document increment the version number (internal) on hit or not (reindex)
|
|
58
48
|
# @option arguments [Boolean] :request_cache Specify if request cache should be used for this request or not, defaults to index level setting
|
|
59
49
|
# @option arguments [Boolean] :refresh Should the effected indexes be refreshed?
|
|
60
|
-
# @option arguments [
|
|
61
|
-
# @option arguments [
|
|
62
|
-
# @option arguments [
|
|
63
|
-
# @option arguments [
|
|
64
|
-
# @option arguments [
|
|
50
|
+
# @option arguments [Time] :timeout Time each individual bulk request should wait for shards that are unavailable.
|
|
51
|
+
# @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the update by query 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)
|
|
52
|
+
# @option arguments [Number] :scroll_size Size on the scroll request powering the update by query
|
|
53
|
+
# @option arguments [Boolean] :wait_for_completion Should the request should block until the update by query operation is complete.
|
|
54
|
+
# @option arguments [Number] :requests_per_second The throttle to set on this request in sub-requests per second. -1 means no throttle.
|
|
55
|
+
# @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.
|
|
65
56
|
#
|
|
66
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
57
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html
|
|
67
58
|
#
|
|
68
59
|
def update_by_query(arguments={})
|
|
69
60
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
|
@@ -88,16 +79,12 @@ module Elasticsearch
|
|
|
88
79
|
:analyze_wildcard,
|
|
89
80
|
:default_operator,
|
|
90
81
|
:df,
|
|
91
|
-
:explain,
|
|
92
|
-
:fields,
|
|
93
|
-
:fielddata_fields,
|
|
94
82
|
:from,
|
|
95
83
|
:ignore_unavailable,
|
|
96
84
|
:allow_no_indices,
|
|
97
85
|
:conflicts,
|
|
98
86
|
:expand_wildcards,
|
|
99
87
|
:lenient,
|
|
100
|
-
:lowercase_expanded_terms,
|
|
101
88
|
:pipeline,
|
|
102
89
|
:preference,
|
|
103
90
|
:q,
|
|
@@ -108,23 +95,16 @@ module Elasticsearch
|
|
|
108
95
|
:size,
|
|
109
96
|
:sort,
|
|
110
97
|
:_source,
|
|
111
|
-
:_source_exclude,
|
|
112
98
|
:_source_excludes,
|
|
113
|
-
:_source_include,
|
|
114
99
|
:_source_includes,
|
|
115
100
|
:terminate_after,
|
|
116
101
|
:stats,
|
|
117
|
-
:suggest_field,
|
|
118
|
-
:suggest_mode,
|
|
119
|
-
:suggest_size,
|
|
120
|
-
:suggest_text,
|
|
121
|
-
:timeout,
|
|
122
|
-
:track_scores,
|
|
123
102
|
:version,
|
|
124
103
|
:version_type,
|
|
125
104
|
:request_cache,
|
|
126
105
|
:refresh,
|
|
127
|
-
:
|
|
106
|
+
:timeout,
|
|
107
|
+
:wait_for_active_shards,
|
|
128
108
|
:scroll_size,
|
|
129
109
|
:wait_for_completion,
|
|
130
110
|
:requests_per_second,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Elasticsearch
|
|
2
|
+
module API
|
|
3
|
+
module Actions
|
|
4
|
+
|
|
5
|
+
# The value of requests_per_second can be changed on a running update by query using the _rethrottle API
|
|
6
|
+
#
|
|
7
|
+
# @option arguments [String] :task_id The task id to rethrottle (*Required*)
|
|
8
|
+
# @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
|
|
9
|
+
#
|
|
10
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html
|
|
11
|
+
#
|
|
12
|
+
def update_by_query_rethrottle(arguments={})
|
|
13
|
+
raise ArgumentError, "Required argument 'task_id' missing" unless arguments[:task_id]
|
|
14
|
+
method = Elasticsearch::API::HTTP_POST
|
|
15
|
+
path = "_update_by_query/#{arguments[:task_id]}/_rethrottle"
|
|
16
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
17
|
+
body = nil
|
|
18
|
+
|
|
19
|
+
perform_request(method, path, params, body).body
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Register this action with its valid params when the module is loaded.
|
|
23
|
+
#
|
|
24
|
+
# @since 6.2.0
|
|
25
|
+
ParamsRegistry.register(:update_by_query_rethrottle, [
|
|
26
|
+
:requests_per_second ].freeze)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -32,21 +32,4 @@ describe 'client.cluster#state' do
|
|
|
32
32
|
expect(client_double.cluster.state(metric: ['foo', 'bar'])).to eq({})
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
|
|
36
|
-
context 'when index templates are specified' do
|
|
37
|
-
|
|
38
|
-
let(:expected_args) do
|
|
39
|
-
[
|
|
40
|
-
'GET',
|
|
41
|
-
'_cluster/state',
|
|
42
|
-
{ index_templates: 'foo,bar' },
|
|
43
|
-
nil,
|
|
44
|
-
nil
|
|
45
|
-
]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it 'performs the request' do
|
|
49
|
-
expect(client_double.cluster.state(index_templates: ['foo', 'bar'])).to eq({})
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
35
|
end
|
|
@@ -15,4 +15,21 @@ describe 'client.cluster#stats' do
|
|
|
15
15
|
it 'performs the request' do
|
|
16
16
|
expect(client_double.cluster.stats).to eq({})
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
context 'when a node_id is specified' do
|
|
20
|
+
|
|
21
|
+
let(:expected_args) do
|
|
22
|
+
[
|
|
23
|
+
'GET',
|
|
24
|
+
'_cluster/stats/nodes/1',
|
|
25
|
+
{},
|
|
26
|
+
nil,
|
|
27
|
+
nil
|
|
28
|
+
]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'performs the request' do
|
|
32
|
+
expect(client_double.cluster.stats(node_id: 1)).to eq({})
|
|
33
|
+
end
|
|
34
|
+
end
|
|
18
35
|
end
|
|
@@ -43,17 +43,6 @@ describe 'client.indices#analyze' do
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
context 'when an url params are specified' do
|
|
47
|
-
|
|
48
|
-
let(:params) do
|
|
49
|
-
{ text: 'foo', analyzer: 'bar' }
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'performs the request' do
|
|
53
|
-
expect(client_double.indices.analyze(text: 'foo', analyzer: 'bar')).to eq({})
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
46
|
context 'when a body is specified' do
|
|
58
47
|
|
|
59
48
|
let(:body) do
|
|
@@ -64,30 +53,4 @@ describe 'client.indices#analyze' do
|
|
|
64
53
|
expect(client_double.indices.analyze(body: 'foo')).to eq({})
|
|
65
54
|
end
|
|
66
55
|
end
|
|
67
|
-
|
|
68
|
-
context 'when filters are specified' do
|
|
69
|
-
|
|
70
|
-
let(:params) do
|
|
71
|
-
{ filters: 'foo,bar', text: 'Test', tokenizer: 'whitespace' }
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'performs the request' do
|
|
75
|
-
expect(client_double.indices.analyze(text: 'Test', tokenizer: 'whitespace', filters: ['foo,bar'])).to eq({})
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
context 'when path must be URL-escaped' do
|
|
80
|
-
|
|
81
|
-
let(:url) do
|
|
82
|
-
'foo%5Ebar/_analyze'
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
let(:params) do
|
|
86
|
-
{ text: 'Test', index: 'foo^bar' }
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
it 'performs the request' do
|
|
90
|
-
expect(client_double.indices.analyze(index: 'foo^bar', text: 'Test')).to eq({})
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
56
|
end
|
|
@@ -41,21 +41,6 @@ describe 'client.cluster#put_settings' do
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
context 'when parameters are specified' do
|
|
45
|
-
|
|
46
|
-
let(:params) do
|
|
47
|
-
{ flat_settings: true }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
let(:url) do
|
|
51
|
-
'foo/_settings'
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it 'performs the request' do
|
|
55
|
-
expect(client_double.indices.put_settings(index: 'foo', flat_settings: true, body: {})).to eq({})
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
44
|
context 'when an index is specified' do
|
|
60
45
|
|
|
61
46
|
let(:url) do
|
|
@@ -61,21 +61,6 @@ describe 'client.cluster#refresh' do
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
context 'when parameters are specified' do
|
|
65
|
-
|
|
66
|
-
let(:params) do
|
|
67
|
-
{ ignore_indices: 'missing' }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
let(:url) do
|
|
71
|
-
'foo/_refresh'
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'performs the request' do
|
|
75
|
-
expect(client_double.indices.refresh(index: 'foo', ignore_indices: 'missing')).to eq({})
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
64
|
context 'when the path needs to be URL-escaped' do
|
|
80
65
|
|
|
81
66
|
let(:url) do
|
|
@@ -61,21 +61,6 @@ describe 'client.cluster#segments' do
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
context 'when parameters are specified' do
|
|
65
|
-
|
|
66
|
-
let(:params) do
|
|
67
|
-
{ ignore_indices: 'missing' }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
let(:url) do
|
|
71
|
-
'foo/_segments'
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'performs the request' do
|
|
75
|
-
expect(client_double.indices.segments(index: 'foo', ignore_indices: 'missing')).to eq({})
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
64
|
context 'when the path needs to be URL-escaped' do
|
|
80
65
|
|
|
81
66
|
let(:url) do
|
|
@@ -66,21 +66,6 @@ describe 'client#mget' do
|
|
|
66
66
|
it 'performs the request' do
|
|
67
67
|
expect(client_double.mget(body: {}, refresh: true)).to eq({})
|
|
68
68
|
end
|
|
69
|
-
|
|
70
|
-
context 'when the fields parameter is specified' do
|
|
71
|
-
|
|
72
|
-
let(:params) do
|
|
73
|
-
{ fields: 'foo,bar' }
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
let(:body) do
|
|
77
|
-
{}
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it 'performs the request' do
|
|
81
|
-
expect(client_double.mget(body: {}, fields: ['foo', 'bar'])).to eq({})
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
69
|
end
|
|
85
70
|
|
|
86
71
|
context 'when the request needs to be URL-escaped' do
|