elasticsearch-api 1.0.17 → 1.0.18
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/Rakefile +2 -1
- data/elasticsearch-api.gemspec +6 -1
- data/lib/elasticsearch/api.rb +1 -0
- data/lib/elasticsearch/api/actions/bulk.rb +3 -1
- data/lib/elasticsearch/api/actions/cat/plugins.rb +1 -1
- data/lib/elasticsearch/api/actions/cat/tasks.rb +41 -0
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +3 -0
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +26 -0
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +4 -1
- data/lib/elasticsearch/api/actions/cluster/health.rb +4 -1
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +1 -1
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +3 -1
- data/lib/elasticsearch/api/actions/cluster/stats.rb +30 -0
- data/lib/elasticsearch/api/actions/index.rb +1 -0
- data/lib/elasticsearch/api/actions/indices/analyze.rb +5 -0
- data/lib/elasticsearch/api/actions/indices/close.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/create.rb +8 -1
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +5 -1
- data/lib/elasticsearch/api/actions/indices/get.rb +10 -1
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +2 -0
- data/lib/elasticsearch/api/actions/indices/open.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +6 -0
- data/lib/elasticsearch/api/actions/indices/segments.rb +8 -6
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +29 -0
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +27 -0
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +32 -0
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +29 -0
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +3 -1
- data/lib/elasticsearch/api/actions/nodes/info.rb +4 -2
- data/lib/elasticsearch/api/actions/nodes/stats.rb +3 -1
- data/lib/elasticsearch/api/actions/ping.rb +7 -1
- data/lib/elasticsearch/api/actions/reindex.rb +69 -0
- data/lib/elasticsearch/api/actions/search.rb +5 -0
- data/lib/elasticsearch/api/actions/tasks/list.rb +3 -0
- data/lib/elasticsearch/api/actions/update_by_query.rb +128 -0
- data/lib/elasticsearch/api/namespace/ingest.rb +20 -0
- data/lib/elasticsearch/api/utils.rb +55 -0
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +3 -3
- data/test/unit/cat/plugins_test.rb +1 -1
- data/test/unit/cat/tasks_test.rb +26 -0
- data/test/unit/cluster/allocation_explain_test.rb +26 -0
- data/test/unit/cluster/health_test.rb +9 -0
- data/test/unit/cluster/pending_tasks_test.rb +1 -1
- data/test/unit/cluster/stats_test.rb +26 -0
- data/test/unit/ingest/delete_pipeline_test.rb +41 -0
- data/test/unit/ingest/get_pipeline_test.rb +41 -0
- data/test/unit/ingest/put_pipeline_test.rb +46 -0
- data/test/unit/ingest/simulate_test.rb +35 -0
- data/test/unit/ping_test.rb +6 -1
- data/test/unit/reindex_test.rb +26 -0
- data/test/unit/update_by_query_test.rb +26 -0
- data/test/unit/utils_test.rb +59 -0
- metadata +34 -6
@@ -0,0 +1,29 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Ingest
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Delete a speficied pipeline
|
7
|
+
#
|
8
|
+
# @option arguments [String] :id Pipeline ID (*Required*)
|
9
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
10
|
+
# @option arguments [Time] :timeout Explicit operation timeout
|
11
|
+
#
|
12
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
|
13
|
+
#
|
14
|
+
def delete_pipeline(arguments={})
|
15
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
16
|
+
valid_params = [
|
17
|
+
:master_timeout,
|
18
|
+
:timeout ]
|
19
|
+
method = 'DELETE'
|
20
|
+
path = Utils.__pathify "_ingest/pipeline", Utils.__escape(arguments[:id])
|
21
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
22
|
+
body = nil
|
23
|
+
|
24
|
+
perform_request(method, path, params, body).body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Ingest
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Return a specified pipeline
|
7
|
+
#
|
8
|
+
# @option arguments [String] :id Comma separated list of pipeline ids. Wildcards supported (*Required*)
|
9
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
10
|
+
#
|
11
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
|
12
|
+
#
|
13
|
+
def get_pipeline(arguments={})
|
14
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
15
|
+
valid_params = [
|
16
|
+
:master_timeout ]
|
17
|
+
method = 'GET'
|
18
|
+
path = Utils.__pathify "_ingest/pipeline", Utils.__escape(arguments[:id])
|
19
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
20
|
+
body = nil
|
21
|
+
|
22
|
+
perform_request(method, path, params, body).body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Ingest
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Add or update a specified pipeline
|
7
|
+
#
|
8
|
+
# @option arguments [String] :id Pipeline ID (*Required*)
|
9
|
+
# @option arguments [Hash] :body The ingest definition (*Required*)
|
10
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
11
|
+
# @option arguments [Time] :timeout Explicit operation timeout
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
|
14
|
+
#
|
15
|
+
def put_pipeline(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
17
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
18
|
+
valid_params = [
|
19
|
+
:master_timeout,
|
20
|
+
:timeout ]
|
21
|
+
method = 'PUT'
|
22
|
+
path = Utils.__pathify "_ingest/pipeline", Utils.__escape(arguments[:id])
|
23
|
+
|
24
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
25
|
+
body = arguments[:body]
|
26
|
+
|
27
|
+
perform_request(method, path, params, body).body
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Ingest
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Execute a specific pipeline against the set of documents provided in the body of the request
|
7
|
+
#
|
8
|
+
# @option arguments [String] :id Pipeline ID
|
9
|
+
# @option arguments [Hash] :body The pipeline definition (*Required*)
|
10
|
+
# @option arguments [Boolean] :verbose Verbose mode. Display data output for each processor
|
11
|
+
# in executed pipeline
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html
|
14
|
+
#
|
15
|
+
def simulate(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
17
|
+
valid_params = [
|
18
|
+
:verbose ]
|
19
|
+
method = 'GET'
|
20
|
+
path = Utils.__pathify "_ingest/pipeline", Utils.__escape(arguments[:id]), '_simulate'
|
21
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
22
|
+
body = arguments[:body]
|
23
|
+
|
24
|
+
perform_request(method, path, params, body).body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -20,6 +20,7 @@ module Elasticsearch
|
|
20
20
|
# @option arguments [Number] :snapshots Number of samples of thread stacktrace (default: 10)
|
21
21
|
# @option arguments [Number] :threads Specify the number of threads to provide information for (default: 3)
|
22
22
|
# @option arguments [String] :type The type to sample (default: cpu) (options: cpu, wait, block)
|
23
|
+
# @option arguments [Time] :timeout Explicit operation timeout
|
23
24
|
#
|
24
25
|
# @return [String]
|
25
26
|
#
|
@@ -30,7 +31,8 @@ module Elasticsearch
|
|
30
31
|
:interval,
|
31
32
|
:snapshots,
|
32
33
|
:threads,
|
33
|
-
:type
|
34
|
+
:type,
|
35
|
+
:timeout ]
|
34
36
|
|
35
37
|
method = HTTP_GET
|
36
38
|
path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'hot_threads'
|
@@ -35,6 +35,7 @@ module Elasticsearch
|
|
35
35
|
# @option arguments [Boolean] :settings Return information about node settings
|
36
36
|
# @option arguments [Boolean] :thread_pool Return information about the thread pool
|
37
37
|
# @option arguments [Boolean] :transport Return information about transport
|
38
|
+
# @option arguments [Time] :timeout Explicit operation timeout
|
38
39
|
#
|
39
40
|
# @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/
|
40
41
|
#
|
@@ -52,9 +53,10 @@ module Elasticsearch
|
|
52
53
|
:process,
|
53
54
|
:settings,
|
54
55
|
:thread_pool,
|
55
|
-
:transport
|
56
|
+
:transport,
|
57
|
+
:timeout ]
|
56
58
|
|
57
|
-
valid_params = []
|
59
|
+
valid_params = [ :timeout ]
|
58
60
|
|
59
61
|
method = HTTP_GET
|
60
62
|
|
@@ -37,6 +37,7 @@ module Elasticsearch
|
|
37
37
|
# @option arguments [String] :level Specify the level for aggregating indices stats
|
38
38
|
# (options: node, indices, shards)
|
39
39
|
# @option arguments [List] :types A comma-separated list of document types for the `indexing` index metric
|
40
|
+
# @option arguments [Time] :timeout Explicit operation timeout
|
40
41
|
#
|
41
42
|
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html
|
42
43
|
#
|
@@ -53,7 +54,8 @@ module Elasticsearch
|
|
53
54
|
:groups,
|
54
55
|
:human,
|
55
56
|
:level,
|
56
|
-
:types
|
57
|
+
:types,
|
58
|
+
:timeout ]
|
57
59
|
|
58
60
|
method = HTTP_GET
|
59
61
|
|
@@ -16,8 +16,14 @@ module Elasticsearch
|
|
16
16
|
params = {}
|
17
17
|
body = nil
|
18
18
|
|
19
|
-
|
19
|
+
begin
|
20
20
|
perform_request(method, path, params, body).status == 200 ? true : false
|
21
|
+
rescue Exception => e
|
22
|
+
if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not\s*Found|404|ConnectionFailed/i
|
23
|
+
false
|
24
|
+
else
|
25
|
+
raise e
|
26
|
+
end
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
# Copy documents from one index to another, potentially changing
|
6
|
+
# its settings, mappings and the documents itself.
|
7
|
+
#
|
8
|
+
# @example Copy documents into a different index
|
9
|
+
#
|
10
|
+
# client.reindex body: { source: { index: 'test1' }, dest: { index: 'test2' } }
|
11
|
+
#
|
12
|
+
# @example Limit the copied documents with a query
|
13
|
+
#
|
14
|
+
# client.reindex body: {
|
15
|
+
# source: {
|
16
|
+
# index: 'test1',
|
17
|
+
# query: { terms: { category: ['one', 'two'] } }
|
18
|
+
# },
|
19
|
+
# dest: {
|
20
|
+
# index: 'test2'
|
21
|
+
# }
|
22
|
+
# }
|
23
|
+
#
|
24
|
+
# @example Remove a field from reindexed documents
|
25
|
+
#
|
26
|
+
# client.reindex body: {
|
27
|
+
# source: {
|
28
|
+
# index: 'test1'
|
29
|
+
# },
|
30
|
+
# dest: {
|
31
|
+
# index: 'test3'
|
32
|
+
# },
|
33
|
+
# script: {
|
34
|
+
# inline: 'ctx._source.remove("category")'
|
35
|
+
# }
|
36
|
+
# }
|
37
|
+
#
|
38
|
+
# @option arguments [Hash] :body The definition of the operation (source index, target index, ...)
|
39
|
+
# (*Required*)
|
40
|
+
# @option arguments [Boolean] :refresh Whether the affected indexes should be refreshed
|
41
|
+
# @option arguments [Time] :timeout Time each individual bulk request should wait for shards
|
42
|
+
# that are unavailable. (Default: 1m)
|
43
|
+
# @option arguments [String] :consistency Explicit write consistency setting for the operation
|
44
|
+
# (Options: one, quorum, all)
|
45
|
+
# @option arguments [Boolean] :wait_for_completion Whether the request should block and wait until
|
46
|
+
# the operation has completed
|
47
|
+
# @option arguments [Float] :requests_per_second The throttling for this request in sub-requests per second.
|
48
|
+
# 0 means set no throttling (default)
|
49
|
+
#
|
50
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html
|
51
|
+
#
|
52
|
+
def reindex(arguments={})
|
53
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
54
|
+
valid_params = [
|
55
|
+
:refresh,
|
56
|
+
:timeout,
|
57
|
+
:consistency,
|
58
|
+
:wait_for_completion,
|
59
|
+
:requests_per_second ]
|
60
|
+
method = 'POST'
|
61
|
+
path = "_reindex"
|
62
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
63
|
+
body = arguments[:body]
|
64
|
+
|
65
|
+
perform_request(method, path, params, body).body
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -87,6 +87,8 @@ module Elasticsearch
|
|
87
87
|
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
88
88
|
# (default: random)
|
89
89
|
# @option arguments [String] :q Query in the Lucene query string syntax
|
90
|
+
# @option arguments [Boolean] :request_cache Specify if request cache should be used for this request
|
91
|
+
# (defaults to index level setting)
|
90
92
|
# @option arguments [List] :routing A comma-separated list of specific routing values
|
91
93
|
# @option arguments [Duration] :scroll Specify how long a consistent view of the index should be maintained
|
92
94
|
# for scrolled search
|
@@ -105,6 +107,7 @@ module Elasticsearch
|
|
105
107
|
# @option arguments [String] :suggest_mode Specify suggest mode (options: missing, popular, always)
|
106
108
|
# @option arguments [Number] :suggest_size How many suggestions to return in response
|
107
109
|
# @option arguments [Text] :suggest_text The source text for which the suggestions should be returned
|
110
|
+
# @option arguments [Number] :terminate_after The maximum number of documents to collect for each shard
|
108
111
|
# @option arguments [Time] :timeout Explicit operation timeout
|
109
112
|
# @option arguments [Boolean] :version Specify whether to return document version as part of a hit
|
110
113
|
#
|
@@ -134,6 +137,7 @@ module Elasticsearch
|
|
134
137
|
:preference,
|
135
138
|
:q,
|
136
139
|
:query_cache,
|
140
|
+
:request_cache,
|
137
141
|
:routing,
|
138
142
|
:scroll,
|
139
143
|
:search_type,
|
@@ -148,6 +152,7 @@ module Elasticsearch
|
|
148
152
|
:suggest_mode,
|
149
153
|
:suggest_size,
|
150
154
|
:suggest_text,
|
155
|
+
:terminate_after,
|
151
156
|
:timeout,
|
152
157
|
:version ]
|
153
158
|
|
@@ -15,6 +15,8 @@ module Elasticsearch
|
|
15
15
|
# @option arguments [String] :parent_node Return tasks with specified parent node.
|
16
16
|
# @option arguments [Number] :parent_task Return tasks with specified parent task id.
|
17
17
|
# Set to -1 to return all.
|
18
|
+
# @option arguments [String] :group_by Group tasks by nodes or parent/child relationships
|
19
|
+
# Options: nodes, parents
|
18
20
|
# @option arguments [Boolean] :wait_for_completion Wait for the matching tasks to complete (default: false)
|
19
21
|
#
|
20
22
|
# @see http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks-list.html
|
@@ -26,6 +28,7 @@ module Elasticsearch
|
|
26
28
|
:detailed,
|
27
29
|
:parent_node,
|
28
30
|
:parent_task,
|
31
|
+
:group_by,
|
29
32
|
:wait_for_completion ]
|
30
33
|
|
31
34
|
task_id = arguments.delete(:task_id)
|
@@ -0,0 +1,128 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
# Process every document matching a query, potentially updating it
|
6
|
+
#
|
7
|
+
# @example Update all documents in the index, eg. to pick up new mappings
|
8
|
+
#
|
9
|
+
# client.update_by_query index: 'articles'
|
10
|
+
#
|
11
|
+
# @example Update a property of documents matching a query in the index
|
12
|
+
#
|
13
|
+
# client.update_by_query index: 'article',
|
14
|
+
# body: {
|
15
|
+
# script: { inline: 'ctx._source.views += 1' },
|
16
|
+
# query: { match: { title: 'foo' } }
|
17
|
+
# }
|
18
|
+
#
|
19
|
+
# @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 (*Required*)
|
20
|
+
# @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
|
21
|
+
# @option arguments [Hash] :body The search definition using the Query DSL
|
22
|
+
# @option arguments [String] :analyzer The analyzer to use for the query string
|
23
|
+
# @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false)
|
24
|
+
# @option arguments [String] :default_operator The default operator for query string query (AND or OR) (options: AND, OR)
|
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
|
+
# @option arguments [Number] :from Starting offset (default: 0)
|
30
|
+
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
31
|
+
# @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 reindex hits version conflicts? (options: abort, proceed)
|
33
|
+
# @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
|
+
# @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
|
+
# @option arguments [String] :pipeline Ingest pipeline to set on index requests made by this action. (default: none)
|
37
|
+
# @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
|
38
|
+
# @option arguments [String] :q Query in the Lucene query string syntax
|
39
|
+
# @option arguments [List] :routing A comma-separated list of specific routing values
|
40
|
+
# @option arguments [Duration] :scroll Specify how long a consistent view of the index should be maintained for scrolled search
|
41
|
+
# @option arguments [String] :search_type Search operation type (options: query_then_fetch, dfs_query_then_fetch)
|
42
|
+
# @option arguments [Time] :search_timeout Explicit timeout for each search request. Defaults to no timeout.
|
43
|
+
# @option arguments [Number] :size Number of hits to return (default: 10)
|
44
|
+
# @option arguments [List] :sort A comma-separated list of <field>:<direction> pairs
|
45
|
+
# @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] :_source_exclude A list of fields to exclude from the returned _source field
|
47
|
+
# @option arguments [List] :_source_include A list of fields to extract and return from the _source field
|
48
|
+
# @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
|
+
# @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
|
+
# @option arguments [Boolean] :version Specify whether to return document version as part of a hit
|
57
|
+
# @option arguments [Boolean] :version_type Should the document increment the version number (internal) on hit or not (reindex)
|
58
|
+
# @option arguments [Boolean] :request_cache Specify if request cache should be used for this request or not, defaults to index level setting
|
59
|
+
# @option arguments [Boolean] :refresh Should the effected indexes be refreshed?
|
60
|
+
# @option arguments [String] :consistency Explicit write consistency setting for the operation (options: one, quorum, all)
|
61
|
+
# @option arguments [Integer] :scroll_size Size on the scroll request powering the update_by_query
|
62
|
+
# @option arguments [Boolean] :wait_for_completion Should the request should block until the reindex is complete.
|
63
|
+
# @option arguments [Float] :requests_per_second The throttle for this request in sub-requests per second. 0 means set no throttle.
|
64
|
+
#
|
65
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html
|
66
|
+
#
|
67
|
+
def update_by_query(arguments={})
|
68
|
+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
69
|
+
|
70
|
+
valid_params = [
|
71
|
+
:analyzer,
|
72
|
+
:analyze_wildcard,
|
73
|
+
:default_operator,
|
74
|
+
:df,
|
75
|
+
:explain,
|
76
|
+
:fields,
|
77
|
+
:fielddata_fields,
|
78
|
+
:from,
|
79
|
+
:ignore_unavailable,
|
80
|
+
:allow_no_indices,
|
81
|
+
:conflicts,
|
82
|
+
:expand_wildcards,
|
83
|
+
:lenient,
|
84
|
+
:lowercase_expanded_terms,
|
85
|
+
:pipeline,
|
86
|
+
:preference,
|
87
|
+
:q,
|
88
|
+
:routing,
|
89
|
+
:scroll,
|
90
|
+
:search_type,
|
91
|
+
:search_timeout,
|
92
|
+
:size,
|
93
|
+
:sort,
|
94
|
+
:_source,
|
95
|
+
:_source_exclude,
|
96
|
+
:_source_include,
|
97
|
+
:terminate_after,
|
98
|
+
:stats,
|
99
|
+
:suggest_field,
|
100
|
+
:suggest_mode,
|
101
|
+
:suggest_size,
|
102
|
+
:suggest_text,
|
103
|
+
:timeout,
|
104
|
+
:track_scores,
|
105
|
+
:version,
|
106
|
+
:version_type,
|
107
|
+
:request_cache,
|
108
|
+
:refresh,
|
109
|
+
:consistency,
|
110
|
+
:scroll_size,
|
111
|
+
:wait_for_completion,
|
112
|
+
:requests_per_second ]
|
113
|
+
|
114
|
+
method = HTTP_POST
|
115
|
+
|
116
|
+
path = Utils.__pathify Utils.__listify(arguments[:index]),
|
117
|
+
Utils.__listify(arguments[:type]),
|
118
|
+
'/_update_by_query'
|
119
|
+
|
120
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
121
|
+
|
122
|
+
body = arguments[:body]
|
123
|
+
|
124
|
+
perform_request(method, path, params, body).body
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|