elasticsearch-api 6.2.0 → 6.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/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 -73
- data/lib/elasticsearch/api/actions/delete_template.rb +0 -21
- data/lib/elasticsearch/api/actions/field_stats.rb +0 -36
- data/lib/elasticsearch/api/actions/get_template.rb +0 -27
- data/lib/elasticsearch/api/actions/indices/delete_mapping.rb +0 -26
- data/lib/elasticsearch/api/actions/indices/delete_warmer.rb +0 -32
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +0 -37
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -62
- data/lib/elasticsearch/api/actions/indices/optimize.rb +0 -77
- data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -65
- data/lib/elasticsearch/api/actions/indices/seal.rb +0 -24
- data/lib/elasticsearch/api/actions/indices/snapshot_index.rb +0 -44
- data/lib/elasticsearch/api/actions/indices/status.rb +0 -63
- data/lib/elasticsearch/api/actions/list_benchmarks.rb +0 -27
- data/lib/elasticsearch/api/actions/mlt.rb +0 -130
- data/lib/elasticsearch/api/actions/mpercolate.rb +0 -62
- data/lib/elasticsearch/api/actions/nodes/shutdown.rb +0 -39
- data/lib/elasticsearch/api/actions/percolate.rb +0 -73
- data/lib/elasticsearch/api/actions/put_template.rb +0 -25
- data/lib/elasticsearch/api/actions/remote/info.rb +0 -21
- data/lib/elasticsearch/api/actions/search_exists.rb +0 -63
- data/lib/elasticsearch/api/actions/suggest.rb +0 -49
- data/spec/elasticsearch/api/actions/delete_template_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/field_stats_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/get_template_spec.rb +0 -52
- data/spec/elasticsearch/api/actions/indices/delete_mapping_spec.rb +0 -77
- data/spec/elasticsearch/api/actions/indices/delete_warmer_spec.rb +0 -86
- data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +0 -68
- data/spec/elasticsearch/api/actions/indices/get_aliases_spec.rb +0 -55
- data/spec/elasticsearch/api/actions/indices/get_warmer_spec.rb +0 -48
- data/spec/elasticsearch/api/actions/indices/optimize_spec.rb +0 -63
- data/spec/elasticsearch/api/actions/indices/put_warmer_spec.rb +0 -101
- data/spec/elasticsearch/api/actions/indices/seal_spec.rb +0 -18
- data/spec/elasticsearch/api/actions/indices/snapshot_index_spec.rb +0 -89
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/status_spec.rb +0 -92
- data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +0 -68
- data/spec/elasticsearch/api/actions/list_benchmarks_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/mlt_spec.rb +0 -117
- data/spec/elasticsearch/api/actions/mpercolate_spec.rb +0 -49
- data/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb +0 -59
- data/spec/elasticsearch/api/actions/percolate_spec.rb +0 -67
- data/spec/elasticsearch/api/actions/put_template_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/remote/info_spec.rb +0 -18
- data/spec/elasticsearch/api/actions/search_exists_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/suggest_spec.rb +0 -77
@@ -1,63 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Return whether documents exists for a particular query
|
6
|
-
#
|
7
|
-
# @option arguments [List] :index A comma-separated list of indices to restrict the results
|
8
|
-
# @option arguments [List] :type A comma-separated list of types to restrict the results
|
9
|
-
# @option arguments [Hash] :body A query to restrict the results specified with the Query DSL (optional)
|
10
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
11
|
-
# unavailable (missing or closed)
|
12
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves
|
13
|
-
# into no concrete indices.
|
14
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices
|
15
|
-
# that are open, closed or both.
|
16
|
-
# (options: open, closed, none, all)
|
17
|
-
# @option arguments [Number] :min_score Include only documents with a specific `_score` value in the result
|
18
|
-
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
19
|
-
# (default: random)
|
20
|
-
# @option arguments [String] :routing Specific routing value
|
21
|
-
# @option arguments [String] :q Query in the Lucene query string syntax
|
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
|
24
|
-
# analyzed (default: false)
|
25
|
-
# @option arguments [String] :default_operator The default operator for query string query (AND or OR)
|
26
|
-
# (options: AND, OR)
|
27
|
-
# @option arguments [String] :df The field to use as default where no field prefix is given
|
28
|
-
# in the query string
|
29
|
-
# @option arguments [Boolean] :lenient Specify whether format-based query failures
|
30
|
-
# (such as providing text to a numeric field) should be ignored
|
31
|
-
# @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
|
32
|
-
#
|
33
|
-
# @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-exists.html
|
34
|
-
#
|
35
|
-
def search_exists(arguments={})
|
36
|
-
method = 'POST'
|
37
|
-
path = "_search/exists"
|
38
|
-
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
39
|
-
body = arguments[:body]
|
40
|
-
|
41
|
-
perform_request(method, path, params, body).body
|
42
|
-
end
|
43
|
-
|
44
|
-
# Register this action with its valid params when the module is loaded.
|
45
|
-
#
|
46
|
-
# @since 6.2.0
|
47
|
-
ParamsRegistry.register(:search_exists, [
|
48
|
-
:ignore_unavailable,
|
49
|
-
:allow_no_indices,
|
50
|
-
:expand_wildcards,
|
51
|
-
:min_score,
|
52
|
-
:preference,
|
53
|
-
:routing,
|
54
|
-
:q,
|
55
|
-
:analyzer,
|
56
|
-
:analyze_wildcard,
|
57
|
-
:default_operator,
|
58
|
-
:df,
|
59
|
-
:lenient,
|
60
|
-
:lowercase_expanded_terms ].freeze)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module Elasticsearch
|
2
|
-
module API
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
# Return query terms suggestions based on provided text and configuration.
|
6
|
-
#
|
7
|
-
# Pass the request definition in the `:body` argument.
|
8
|
-
#
|
9
|
-
# @example Return query terms suggestions ("auto-correction")
|
10
|
-
#
|
11
|
-
# client.suggest index: 'myindex',
|
12
|
-
# body: { my_suggest: { text: 'tset', term: { field: 'title' } } }
|
13
|
-
# # => { ... "my_suggest"=>[ {"text"=>"tset", ... "options"=>[{"text"=>"test", "score"=>0.75, "freq"=>5}] }]}
|
14
|
-
#
|
15
|
-
# @option arguments [List] :index A comma-separated list of index names to restrict the operation;
|
16
|
-
# use `_all` or empty string to perform the operation on all indices
|
17
|
-
# @option arguments [Hash] :body The request definition
|
18
|
-
# @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore `missing` ones
|
19
|
-
# (options: none, missing)
|
20
|
-
# @option arguments [String] :preference Specify the node or shard the operation should be performed on
|
21
|
-
# (default: random)
|
22
|
-
# @option arguments [String] :routing Specific routing value
|
23
|
-
# @option arguments [String] :source The URL-encoded request definition (instead of using request body)
|
24
|
-
#
|
25
|
-
# @since 0.90
|
26
|
-
#
|
27
|
-
# @see http://elasticsearch.org/guide/reference/api/search/suggest/
|
28
|
-
#
|
29
|
-
def suggest(arguments={})
|
30
|
-
method = HTTP_POST
|
31
|
-
path = Utils.__pathify( Utils.__listify(arguments[:index]), '_suggest' )
|
32
|
-
|
33
|
-
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
34
|
-
body = arguments[:body]
|
35
|
-
|
36
|
-
perform_request(method, path, params, body).body
|
37
|
-
end
|
38
|
-
|
39
|
-
# Register this action with its valid params when the module is loaded.
|
40
|
-
#
|
41
|
-
# @since 6.2.0
|
42
|
-
ParamsRegistry.register(:suggest, [
|
43
|
-
:ignore_indices,
|
44
|
-
:preference,
|
45
|
-
:routing,
|
46
|
-
:source ].freeze)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#delete_template' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'DELETE',
|
8
|
-
'_search/template/foo',
|
9
|
-
{},
|
10
|
-
nil
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'performs the request' do
|
15
|
-
expect(client_double.delete_template(id: 'foo')).to eq({})
|
16
|
-
end
|
17
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#get_template' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'GET',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
nil
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:params) do
|
15
|
-
{ }
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:client) do
|
19
|
-
Class.new { include Elasticsearch::API }.new
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when the `lang` parameter is specified' do
|
23
|
-
|
24
|
-
let(:url) do
|
25
|
-
'_scripts/foo'
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'performs the request' do
|
29
|
-
expect(client_double.get_template(id: 'foo')).to eq({})
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'when the request raises a NotFound exception' do
|
34
|
-
|
35
|
-
before do
|
36
|
-
expect(client).to receive(:perform_request).and_raise(NotFound)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'raises the exception' do
|
40
|
-
expect {
|
41
|
-
client.get_template(id: 'foo')
|
42
|
-
}.to raise_exception(NotFound)
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when the ignore parameter is specified' do
|
46
|
-
|
47
|
-
it 'returns false' do
|
48
|
-
expect(client.get_template(id: 'foo', ignore: 404)).to eq(false)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.indices#delete_mapping' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'DELETE',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
nil,
|
11
|
-
nil
|
12
|
-
]
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:params) do
|
16
|
-
{}
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when there is no index specified' do
|
20
|
-
|
21
|
-
let(:client) do
|
22
|
-
Class.new { include Elasticsearch::API }.new
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'raises an exception' do
|
26
|
-
expect {
|
27
|
-
client.indices.delete_mapping(type: 'foo')
|
28
|
-
}.to raise_exception(ArgumentError)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when there is no type specified' do
|
33
|
-
|
34
|
-
let(:client) do
|
35
|
-
Class.new { include Elasticsearch::API }.new
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'raises an exception' do
|
39
|
-
expect {
|
40
|
-
client.indices.delete_mapping(index: 'foo')
|
41
|
-
}.to raise_exception(ArgumentError)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when an index and type are specified' do
|
46
|
-
|
47
|
-
let(:url) do
|
48
|
-
'foo/bar'
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'performs the request' do
|
52
|
-
expect(client_double.indices.delete_mapping(index: 'foo', type: 'bar')).to eq({})
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'when multiple indices are specified' do
|
57
|
-
|
58
|
-
let(:url) do
|
59
|
-
'foo,bar/baz'
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'performs the request' do
|
63
|
-
expect(client_double.indices.delete_mapping(index: ['foo','bar'], type: 'baz')).to eq({})
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'when the path must be URL-escaped' do
|
68
|
-
|
69
|
-
let(:url) do
|
70
|
-
'foo%5Ebar/bar%2Fbam'
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'performs the request' do
|
74
|
-
expect(client_double.indices.delete_mapping(index: 'foo^bar', type: 'bar/bam')).to eq({})
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.indices#delete_warmer' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'DELETE',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
nil,
|
11
|
-
nil
|
12
|
-
]
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:params) do
|
16
|
-
{}
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when an index is not specified' do
|
20
|
-
|
21
|
-
let(:client) do
|
22
|
-
Class.new { include Elasticsearch::API }.new
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'raises an exception' do
|
26
|
-
expect {
|
27
|
-
client.indices.delete_warmer
|
28
|
-
}.to raise_exception(ArgumentError)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when an index is specified' do
|
33
|
-
|
34
|
-
let(:url) do
|
35
|
-
'foo/_warmer'
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'performs the request' do
|
39
|
-
expect(client_double.indices.delete_warmer(index: 'foo')).to eq({})
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when multiple indices are specified' do
|
44
|
-
|
45
|
-
let(:url) do
|
46
|
-
'foo,bar/_warmer'
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'performs the request' do
|
50
|
-
expect(client_double.indices.delete_warmer(index: ['foo', 'bar'])).to eq({})
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'when a single warmer is specified' do
|
55
|
-
|
56
|
-
let(:url) do
|
57
|
-
'foo/_warmer/bar'
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'performs the request' do
|
61
|
-
expect(client_double.indices.delete_warmer(index: 'foo', name: 'bar')).to eq({})
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'when a multiple warmers are specified' do
|
66
|
-
|
67
|
-
let(:url) do
|
68
|
-
'foo/_warmer/bar,baz'
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'performs the request' do
|
72
|
-
expect(client_double.indices.delete_warmer(index: 'foo', name: ['bar', 'baz'])).to eq({})
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'when the path needs to be URL-escaped' do
|
77
|
-
|
78
|
-
let(:url) do
|
79
|
-
'foo%5Ebar/_warmer/bar%2Fbam'
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'performs the request' do
|
83
|
-
expect(client_double.indices.delete_warmer(index: 'foo^bar', name: 'bar/bam')).to eq({})
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.indices#freeze' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'POST',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
nil,
|
11
|
-
nil
|
12
|
-
]
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:params) do
|
16
|
-
{}
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when there is no index specified' do
|
20
|
-
|
21
|
-
let(:client) do
|
22
|
-
Class.new { include Elasticsearch::API }.new
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'raises an exception' do
|
26
|
-
expect {
|
27
|
-
client.indices.freeze
|
28
|
-
}.to raise_exception(ArgumentError)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when an index is specified' do
|
33
|
-
|
34
|
-
let(:url) do
|
35
|
-
'foo/_freeze'
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'performs the request' do
|
39
|
-
expect(client_double.indices.freeze(index: 'foo')).to eq({})
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when params are specified' do
|
44
|
-
|
45
|
-
let(:params) do
|
46
|
-
{ timeout: '1s' }
|
47
|
-
end
|
48
|
-
|
49
|
-
let(:url) do
|
50
|
-
'foo/_freeze'
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'performs the request' do
|
54
|
-
expect(client_double.indices.freeze(index: 'foo', timeout: '1s')).to eq({})
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context 'when the path must be URL-escaped' do
|
59
|
-
|
60
|
-
let(:url) do
|
61
|
-
'foo%5Ebar/_freeze'
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'performs the request' do
|
65
|
-
expect(client_double.indices.freeze(index: 'foo^bar')).to eq({})
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.cluster#get_aliases' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'GET',
|
8
|
-
url,
|
9
|
-
{},
|
10
|
-
nil,
|
11
|
-
nil
|
12
|
-
]
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:url) do
|
16
|
-
'_aliases'
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'performs the request' do
|
20
|
-
expect(client_double.indices.get_aliases).to eq({})
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'when an index is specified' do
|
24
|
-
|
25
|
-
let(:url) do
|
26
|
-
'foo/_aliases'
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'performs the request' do
|
30
|
-
expect(client_double.indices.get_aliases(index: 'foo')).to eq({})
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when a specified alias is specified' do
|
35
|
-
|
36
|
-
let(:url) do
|
37
|
-
'foo/_aliases/bar'
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'performs the request' do
|
41
|
-
expect(client_double.indices.get_aliases(index: 'foo', name: 'bar')).to eq({})
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when the path needs to be URL-escaped' do
|
46
|
-
|
47
|
-
let(:url) do
|
48
|
-
'foo%5Ebar/_aliases'
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'performs the request' do
|
52
|
-
expect(client_double.indices.get_aliases(index: 'foo^bar')).to eq({})
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|