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,32 +6,38 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Ingest
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Delete a speficied pipeline
|
9
|
+
# Deletes a pipeline.
|
11
10
|
#
|
12
|
-
# @option arguments [String] :id Pipeline ID
|
11
|
+
# @option arguments [String] :id Pipeline ID
|
13
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
14
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
14
|
+
|
15
15
|
#
|
16
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/delete-pipeline-api.html
|
17
17
|
#
|
18
|
-
def delete_pipeline(arguments={})
|
18
|
+
def delete_pipeline(arguments = {})
|
19
19
|
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
arguments = arguments.clone
|
22
|
+
|
23
|
+
_id = arguments.delete(:id)
|
24
|
+
|
25
|
+
method = Elasticsearch::API::HTTP_DELETE
|
26
|
+
path = "_ingest/pipeline/#{Utils.__listify(_id)}"
|
22
27
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
23
|
-
body = nil
|
24
28
|
|
29
|
+
body = nil
|
25
30
|
perform_request(method, path, params, body).body
|
26
31
|
end
|
27
32
|
|
28
33
|
# Register this action with its valid params when the module is loaded.
|
29
34
|
#
|
30
|
-
# @since 6.
|
35
|
+
# @since 6.2.0
|
31
36
|
ParamsRegistry.register(:delete_pipeline, [
|
32
|
-
|
33
|
-
|
37
|
+
:master_timeout,
|
38
|
+
:timeout
|
39
|
+
].freeze)
|
40
|
+
end
|
34
41
|
end
|
35
|
-
end
|
36
42
|
end
|
37
43
|
end
|
@@ -6,28 +6,38 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Ingest
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return a specified pipeline
|
9
|
+
# Returns a pipeline.
|
11
10
|
#
|
12
|
-
# @option arguments [String] :id Comma separated list of pipeline ids
|
11
|
+
# @option arguments [String] :id Comma separated list of pipeline ids. Wildcards supported
|
13
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
13
|
+
|
14
14
|
#
|
15
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/
|
15
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/get-pipeline-api.html
|
16
16
|
#
|
17
|
-
def get_pipeline(arguments={})
|
18
|
-
|
19
|
-
|
17
|
+
def get_pipeline(arguments = {})
|
18
|
+
arguments = arguments.clone
|
19
|
+
|
20
|
+
_id = arguments.delete(:id)
|
21
|
+
|
22
|
+
method = Elasticsearch::API::HTTP_GET
|
23
|
+
path = if _id
|
24
|
+
"_ingest/pipeline/#{Utils.__listify(_id)}"
|
25
|
+
else
|
26
|
+
"_ingest/pipeline"
|
27
|
+
end
|
20
28
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
21
|
-
body = nil
|
22
29
|
|
30
|
+
body = nil
|
23
31
|
perform_request(method, path, params, body).body
|
24
32
|
end
|
25
33
|
|
26
34
|
# Register this action with its valid params when the module is loaded.
|
27
35
|
#
|
28
|
-
# @since 6.
|
29
|
-
ParamsRegistry.register(:get_pipeline, [
|
36
|
+
# @since 6.2.0
|
37
|
+
ParamsRegistry.register(:get_pipeline, [
|
38
|
+
:master_timeout
|
39
|
+
].freeze)
|
40
|
+
end
|
30
41
|
end
|
31
|
-
end
|
32
42
|
end
|
33
43
|
end
|
@@ -1,29 +1,28 @@
|
|
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 Ingest
|
4
8
|
module Actions
|
5
|
-
|
6
|
-
# Extracts structured fields out of a single text field within a document. You choose which field to extract
|
7
|
-
# matched fields from, as well as the grok pattern you expect will match.
|
9
|
+
# Returns a list of the built-in patterns.
|
8
10
|
#
|
11
|
+
|
9
12
|
#
|
10
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/
|
13
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/grok-processor.html#grok-processor-rest-get
|
11
14
|
#
|
12
|
-
def processor_grok(arguments={})
|
15
|
+
def processor_grok(arguments = {})
|
16
|
+
arguments = arguments.clone
|
17
|
+
|
13
18
|
method = Elasticsearch::API::HTTP_GET
|
14
19
|
path = "_ingest/processor/grok"
|
15
20
|
params = {}
|
16
|
-
body = nil
|
17
21
|
|
22
|
+
body = nil
|
18
23
|
perform_request(method, path, params, body).body
|
19
24
|
end
|
20
|
-
|
21
|
-
# Register this action with its valid params when the module is loaded.
|
22
|
-
#
|
23
|
-
# @since 6.2.0
|
24
|
-
ParamsRegistry.register(:processor_grok, [
|
25
|
-
].freeze)
|
25
|
+
end
|
26
26
|
end
|
27
|
-
end
|
28
27
|
end
|
29
28
|
end
|
@@ -6,35 +6,40 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Ingest
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Add or update a specified pipeline
|
9
|
+
# Creates or updates a pipeline.
|
11
10
|
#
|
12
|
-
# @option arguments [String] :id Pipeline ID
|
13
|
-
# @option arguments [Hash] :body The ingest definition (*Required*)
|
11
|
+
# @option arguments [String] :id Pipeline ID
|
14
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
15
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
14
|
+
|
15
|
+
# @option arguments [Hash] :body The ingest definition (*Required*)
|
16
16
|
#
|
17
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/
|
17
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/put-pipeline-api.html
|
18
18
|
#
|
19
|
-
def put_pipeline(arguments={})
|
20
|
-
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
19
|
+
def put_pipeline(arguments = {})
|
21
20
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
22
|
-
|
23
|
-
|
21
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
22
|
+
|
23
|
+
arguments = arguments.clone
|
24
24
|
|
25
|
+
_id = arguments.delete(:id)
|
26
|
+
|
27
|
+
method = Elasticsearch::API::HTTP_PUT
|
28
|
+
path = "_ingest/pipeline/#{Utils.__listify(_id)}"
|
25
29
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
26
|
-
body = arguments[:body]
|
27
30
|
|
31
|
+
body = arguments[:body]
|
28
32
|
perform_request(method, path, params, body).body
|
29
33
|
end
|
30
34
|
|
31
35
|
# Register this action with its valid params when the module is loaded.
|
32
36
|
#
|
33
|
-
# @since 6.
|
37
|
+
# @since 6.2.0
|
34
38
|
ParamsRegistry.register(:put_pipeline, [
|
35
|
-
|
36
|
-
|
39
|
+
:master_timeout,
|
40
|
+
:timeout
|
41
|
+
].freeze)
|
42
|
+
end
|
37
43
|
end
|
38
|
-
end
|
39
44
|
end
|
40
45
|
end
|
@@ -6,31 +6,41 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Ingest
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Execute a specific pipeline against the set of documents provided in the body of the request
|
9
|
+
# Allows to simulate a pipeline with example documents.
|
11
10
|
#
|
12
11
|
# @option arguments [String] :id Pipeline ID
|
13
|
-
# @option arguments [
|
14
|
-
|
15
|
-
#
|
12
|
+
# @option arguments [Boolean] :verbose Verbose mode. Display data output for each processor in executed pipeline
|
13
|
+
|
14
|
+
# @option arguments [Hash] :body The simulate definition (*Required*)
|
16
15
|
#
|
17
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/simulate-pipeline-api.html
|
18
17
|
#
|
19
|
-
def simulate(arguments={})
|
18
|
+
def simulate(arguments = {})
|
20
19
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
21
|
-
|
22
|
-
|
20
|
+
|
21
|
+
arguments = arguments.clone
|
22
|
+
|
23
|
+
_id = arguments.delete(:id)
|
24
|
+
|
25
|
+
method = Elasticsearch::API::HTTP_GET
|
26
|
+
path = if _id
|
27
|
+
"_ingest/pipeline/#{Utils.__listify(_id)}/_simulate"
|
28
|
+
else
|
29
|
+
"_ingest/pipeline/_simulate"
|
30
|
+
end
|
23
31
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
24
|
-
body = arguments[:body]
|
25
32
|
|
33
|
+
body = arguments[:body]
|
26
34
|
perform_request(method, path, params, body).body
|
27
35
|
end
|
28
36
|
|
29
37
|
# Register this action with its valid params when the module is loaded.
|
30
38
|
#
|
31
|
-
# @since 6.
|
32
|
-
ParamsRegistry.register(:simulate, [
|
39
|
+
# @since 6.2.0
|
40
|
+
ParamsRegistry.register(:simulate, [
|
41
|
+
:verbose
|
42
|
+
].freeze)
|
43
|
+
end
|
33
44
|
end
|
34
|
-
end
|
35
45
|
end
|
36
46
|
end
|
@@ -5,33 +5,10 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# Return multiple documents from one or more indices in a single request.
|
10
|
-
#
|
11
|
-
# Pass the request definition in the `:body` argument, either as an Array of `docs` specifications,
|
12
|
-
# or `ids`, when the `:index` and document `:type` are specified.
|
13
|
-
#
|
14
|
-
# @example Get multiple documents fully specified in the `docs` definition
|
15
|
-
#
|
16
|
-
# client.mget body: {
|
17
|
-
# docs: [
|
18
|
-
# { _index: 'myindex', _type: 'mytype', _id: '1' },
|
19
|
-
# { _index: 'myindex', _type: 'mytype', _id: '2' },
|
20
|
-
# { _index: 'myindex', _type: 'mytype', _id: '3' }
|
21
|
-
# ]
|
22
|
-
# }
|
23
|
-
#
|
24
|
-
# @example Get multiple documents specified by `ids` while passing `:index` and `:type`
|
25
|
-
#
|
26
|
-
# client.mget index: 'myindex', type: 'mytype', body: { ids: ['1', '2', '3'] }
|
27
|
-
#
|
28
|
-
# @example Get only specific fields from documents
|
29
|
-
#
|
30
|
-
# client.mget index: 'myindex', type: 'mytype', body: { ids: ['1', '2', '3'] }, fields: ['title']
|
8
|
+
# Allows to get multiple documents in one request.
|
31
9
|
#
|
32
10
|
# @option arguments [String] :index The name of the index
|
33
|
-
# @option arguments [String] :type The type of the document
|
34
|
-
# @option arguments [Hash] :body Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. (*Required*)
|
11
|
+
# @option arguments [String] :type The type of the document *Deprecated*
|
35
12
|
# @option arguments [List] :stored_fields A comma-separated list of stored fields to return in the response
|
36
13
|
# @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
|
37
14
|
# @option arguments [Boolean] :realtime Specify whether to perform the operation in realtime or search mode
|
@@ -40,36 +17,52 @@ module Elasticsearch
|
|
40
17
|
# @option arguments [List] :_source True or false to return the _source field or not, or a list of fields to return
|
41
18
|
# @option arguments [List] :_source_excludes A list of fields to exclude from the returned _source field
|
42
19
|
# @option arguments [List] :_source_includes A list of fields to extract and return from the _source field
|
20
|
+
|
21
|
+
# @option arguments [Hash] :body Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. (*Required*)
|
22
|
+
#
|
23
|
+
# *Deprecation notice*:
|
24
|
+
# Specifying types in urls has been deprecated
|
25
|
+
# Deprecated since version 7.0.0
|
26
|
+
#
|
43
27
|
#
|
44
|
-
# @see
|
28
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-multi-get.html
|
45
29
|
#
|
46
|
-
def mget(arguments={})
|
30
|
+
def mget(arguments = {})
|
47
31
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
48
|
-
method = HTTP_GET
|
49
|
-
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
50
|
-
Utils.__escape(arguments[:type]),
|
51
|
-
'_mget'
|
52
32
|
|
53
|
-
|
54
|
-
|
33
|
+
arguments = arguments.clone
|
34
|
+
|
35
|
+
_index = arguments.delete(:index)
|
55
36
|
|
56
|
-
|
37
|
+
_type = arguments.delete(:type)
|
57
38
|
|
39
|
+
method = Elasticsearch::API::HTTP_GET
|
40
|
+
path = if _index && _type
|
41
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_mget"
|
42
|
+
elsif _index
|
43
|
+
"#{Utils.__listify(_index)}/_mget"
|
44
|
+
else
|
45
|
+
"_mget"
|
46
|
+
end
|
47
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
48
|
+
|
49
|
+
body = arguments[:body]
|
58
50
|
perform_request(method, path, params, body).body
|
59
51
|
end
|
60
52
|
|
61
53
|
# Register this action with its valid params when the module is loaded.
|
62
54
|
#
|
63
|
-
# @since 6.
|
55
|
+
# @since 6.2.0
|
64
56
|
ParamsRegistry.register(:mget, [
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
57
|
+
:stored_fields,
|
58
|
+
:preference,
|
59
|
+
:realtime,
|
60
|
+
:refresh,
|
61
|
+
:routing,
|
62
|
+
:_source,
|
63
|
+
:_source_excludes,
|
64
|
+
:_source_includes
|
65
|
+
].freeze)
|
66
|
+
end
|
73
67
|
end
|
74
|
-
end
|
75
68
|
end
|
@@ -5,88 +5,88 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# Perform multiple search operations in a single request.
|
10
|
-
#
|
11
|
-
# Pass the search definitions in the `:body` argument
|
12
|
-
#
|
13
|
-
# @example Perform multiple different searches as `:search`
|
14
|
-
#
|
15
|
-
# client.msearch \
|
16
|
-
# body: [
|
17
|
-
# { search: { query: { match_all: {} } } },
|
18
|
-
# { index: 'myindex', type: 'mytype', search: { query: { query_string: { query: '"Test 1"' } } } },
|
19
|
-
# { search_type: 'count', search: { aggregations: { published: { terms: { field: 'published' } } } } }
|
20
|
-
# ]
|
21
|
-
#
|
22
|
-
# @example Perform multiple different searches as an array of meta/data pairs
|
23
|
-
#
|
24
|
-
# client.msearch \
|
25
|
-
# body: [
|
26
|
-
# { query: { match_all: {} } },
|
27
|
-
# { index: 'myindex', type: 'mytype' },
|
28
|
-
# { query: { query_string: { query: '"Test 1"' } } },
|
29
|
-
# { search_type: 'query_then_fetch' },
|
30
|
-
# { aggregations: { published: { terms: { field: 'published' } } } }
|
31
|
-
# ]
|
8
|
+
# Allows to execute several search operations in one request.
|
32
9
|
#
|
33
10
|
# @option arguments [List] :index A comma-separated list of index names to use as default
|
34
11
|
# @option arguments [List] :type A comma-separated list of document types to use as default
|
35
|
-
# @option arguments [
|
36
|
-
#
|
12
|
+
# @option arguments [String] :search_type Search operation type
|
13
|
+
# (options: query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch)
|
14
|
+
|
37
15
|
# @option arguments [Number] :max_concurrent_searches Controls the maximum number of concurrent searches the multi search api will execute
|
38
16
|
# @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
|
39
17
|
# @option arguments [Number] :pre_filter_shard_size A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
|
40
|
-
# @option arguments [Number] :max_concurrent_shard_requests The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
|
18
|
+
# @option arguments [Number] :max_concurrent_shard_requests The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
|
41
19
|
# @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response
|
42
20
|
# @option arguments [Boolean] :ccs_minimize_roundtrips Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
|
21
|
+
|
22
|
+
# @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
|
43
23
|
#
|
44
|
-
#
|
24
|
+
# *Deprecation notice*:
|
25
|
+
# Specifying types in urls has been deprecated
|
26
|
+
# Deprecated since version 7.0.0
|
45
27
|
#
|
46
|
-
|
28
|
+
#
|
29
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-multi-search.html
|
30
|
+
#
|
31
|
+
def msearch(arguments = {})
|
47
32
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
48
|
-
method = HTTP_GET
|
49
|
-
path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_msearch' )
|
50
33
|
|
34
|
+
arguments = arguments.clone
|
35
|
+
|
36
|
+
_index = arguments.delete(:index)
|
37
|
+
|
38
|
+
_type = arguments.delete(:type)
|
39
|
+
|
40
|
+
method = Elasticsearch::API::HTTP_GET
|
41
|
+
path = if _index && _type
|
42
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_msearch"
|
43
|
+
elsif _index
|
44
|
+
"#{Utils.__listify(_index)}/_msearch"
|
45
|
+
else
|
46
|
+
"_msearch"
|
47
|
+
end
|
51
48
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
52
|
-
body = arguments[:body]
|
53
49
|
|
50
|
+
body = arguments[:body]
|
54
51
|
case
|
55
52
|
when body.is_a?(Array) && body.any? { |d| d.has_key? :search }
|
56
|
-
payload = body
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
payload = body
|
54
|
+
.inject([]) do |sum, item|
|
55
|
+
meta = item
|
56
|
+
data = meta.delete(:search)
|
60
57
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
sum << meta
|
59
|
+
sum << data
|
60
|
+
sum
|
61
|
+
end
|
62
|
+
.map { |item| Elasticsearch::API.serializer.dump(item) }
|
66
63
|
payload << "" unless payload.empty?
|
67
|
-
payload = payload.join("
|
64
|
+
payload = payload.join("
|
65
|
+
")
|
68
66
|
when body.is_a?(Array)
|
69
67
|
payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
|
70
68
|
payload << "" unless payload.empty?
|
71
|
-
payload = payload.join("
|
69
|
+
payload = payload.join("
|
70
|
+
")
|
72
71
|
else
|
73
72
|
payload = body
|
74
|
-
|
73
|
+
end
|
75
74
|
|
76
|
-
perform_request(method, path, params, payload, {"Content-Type" => "application/x-ndjson"}).body
|
75
|
+
perform_request(method, path, params, payload, { "Content-Type" => "application/x-ndjson" }).body
|
77
76
|
end
|
78
77
|
|
79
78
|
# Register this action with its valid params when the module is loaded.
|
80
79
|
#
|
81
|
-
# @since 6.
|
80
|
+
# @since 6.2.0
|
82
81
|
ParamsRegistry.register(:msearch, [
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
82
|
+
:search_type,
|
83
|
+
:max_concurrent_searches,
|
84
|
+
:typed_keys,
|
85
|
+
:pre_filter_shard_size,
|
86
|
+
:max_concurrent_shard_requests,
|
87
|
+
:rest_total_hits_as_int,
|
88
|
+
:ccs_minimize_roundtrips
|
89
|
+
].freeze)
|
90
|
+
end
|
90
91
|
end
|
91
|
-
end
|
92
92
|
end
|
@@ -5,57 +5,68 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
-
|
9
|
-
# Execute several search requests using templates (inline, indexed or stored in a file)
|
10
|
-
#
|
11
|
-
# @example Search with an inline script
|
12
|
-
#
|
13
|
-
# client.msearch_template body: [
|
14
|
-
# { index: 'test' },
|
15
|
-
# { inline: { query: { match: { title: '{{q}}' } } }, params: { q: 'foo'} }
|
16
|
-
# ]
|
8
|
+
# Allows to execute several search template operations in one request.
|
17
9
|
#
|
18
10
|
# @option arguments [List] :index A comma-separated list of index names to use as default
|
19
11
|
# @option arguments [List] :type A comma-separated list of document types to use as default
|
20
|
-
# @option arguments [
|
21
|
-
#
|
12
|
+
# @option arguments [String] :search_type Search operation type
|
13
|
+
# (options: query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch)
|
14
|
+
|
22
15
|
# @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
|
23
16
|
# @option arguments [Number] :max_concurrent_searches Controls the maximum number of concurrent searches the multi search api will execute
|
24
17
|
# @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response
|
25
|
-
|
18
|
+
|
19
|
+
# @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
|
20
|
+
#
|
21
|
+
# *Deprecation notice*:
|
22
|
+
# Specifying types in urls has been deprecated
|
23
|
+
# Deprecated since version 7.0.0
|
24
|
+
#
|
26
25
|
#
|
27
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
26
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-multi-search.html
|
28
27
|
#
|
29
|
-
def msearch_template(arguments={})
|
28
|
+
def msearch_template(arguments = {})
|
30
29
|
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
|
31
|
+
arguments = arguments.clone
|
32
|
+
|
33
|
+
_index = arguments.delete(:index)
|
34
|
+
|
35
|
+
_type = arguments.delete(:type)
|
36
|
+
|
37
|
+
method = Elasticsearch::API::HTTP_GET
|
38
|
+
path = if _index && _type
|
39
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_msearch/template"
|
40
|
+
elsif _index
|
41
|
+
"#{Utils.__listify(_index)}/_msearch/template"
|
42
|
+
else
|
43
|
+
"_msearch/template"
|
44
|
+
end
|
35
45
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
36
|
-
body = arguments[:body]
|
37
46
|
|
47
|
+
body = arguments[:body]
|
38
48
|
case
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
when body.is_a?(Array)
|
50
|
+
payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
|
51
|
+
payload << "" unless payload.empty?
|
52
|
+
payload = payload.join("
|
53
|
+
")
|
54
|
+
else
|
55
|
+
payload = body
|
56
|
+
end
|
57
|
+
|
58
|
+
perform_request(method, path, params, payload, { "Content-Type" => "application/x-ndjson" }).body
|
48
59
|
end
|
49
60
|
|
50
61
|
# Register this action with its valid params when the module is loaded.
|
51
62
|
#
|
52
|
-
# @since 6.
|
63
|
+
# @since 6.2.0
|
53
64
|
ParamsRegistry.register(:msearch_template, [
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
65
|
+
:search_type,
|
66
|
+
:typed_keys,
|
67
|
+
:max_concurrent_searches,
|
68
|
+
:rest_total_hits_as_int
|
69
|
+
].freeze)
|
70
|
+
end
|
59
71
|
end
|
60
|
-
end
|
61
72
|
end
|