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,68 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.indices#unfreeze' 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.unfreeze
|
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/_unfreeze'
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'performs the request' do
|
39
|
-
expect(client_double.indices.unfreeze(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/_unfreeze'
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'performs the request' do
|
54
|
-
expect(client_double.indices.unfreeze(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/_unfreeze'
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'performs the request' do
|
65
|
-
expect(client_double.indices.unfreeze(index: 'foo^bar')).to eq({})
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#mlt' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'GET',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
body
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:body) do
|
15
|
-
nil
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:params) do
|
19
|
-
{}
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:client) do
|
23
|
-
Class.new { include Elasticsearch::API }.new
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'requires the :index argument' do
|
27
|
-
expect {
|
28
|
-
client.mlt(type: 'bar', id: '1')
|
29
|
-
}.to raise_exception(ArgumentError)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'requires the :id argument' do
|
33
|
-
expect {
|
34
|
-
client.mlt(index: 'foo', type: 'bar')
|
35
|
-
}.to raise_exception(ArgumentError)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'requires the :type argument' do
|
39
|
-
expect {
|
40
|
-
client.mlt(index: 'foo', id: '1')
|
41
|
-
}.to raise_exception(ArgumentError)
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when an index is specified' do
|
45
|
-
|
46
|
-
let(:url) do
|
47
|
-
'foo/bar/1/_mlt'
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'performs the request' do
|
51
|
-
expect(client_double.mlt(index: 'foo', type: 'bar', id: '1')).to eq({})
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'when url parameters are provided' do
|
56
|
-
|
57
|
-
let(:url) do
|
58
|
-
'foo/bar/1/_mlt'
|
59
|
-
end
|
60
|
-
|
61
|
-
let(:params) do
|
62
|
-
{ max_doc_freq: 1 }
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'performs the request' do
|
66
|
-
expect(client_double.mlt(index: 'foo', type: 'bar', id: '1', max_doc_freq: 1)).to eq({})
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'when url parameters as lists are provided' do
|
71
|
-
|
72
|
-
let(:url) do
|
73
|
-
'foo/bar/1/_mlt'
|
74
|
-
end
|
75
|
-
|
76
|
-
let(:params) do
|
77
|
-
{ mlt_fields: 'foo,bar',
|
78
|
-
search_indices: 'A,B',
|
79
|
-
search_types: 'X,Y',
|
80
|
-
stop_words: 'lam,bam' }
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'performs the request' do
|
84
|
-
expect(client_double.mlt( index: 'foo', type: 'bar', id: '1',
|
85
|
-
mlt_fields: ['foo', 'bar'],
|
86
|
-
search_indices: ['A', 'B'],
|
87
|
-
search_types: ['X', 'Y'],
|
88
|
-
stop_words: ['lam','bam'])).to eq({})
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'when the request needs to be URL-escaped' do
|
93
|
-
|
94
|
-
let(:url) do
|
95
|
-
'foo%5Ebar/bar%2Fbam/1/_mlt'
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'performs the request' do
|
99
|
-
expect(client_double.mlt(index: 'foo^bar', type: 'bar/bam', id: '1')).to eq({})
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when a search criteria is provided' do
|
104
|
-
|
105
|
-
let(:url) do
|
106
|
-
'foo/bar/1/_mlt'
|
107
|
-
end
|
108
|
-
|
109
|
-
let(:body) do
|
110
|
-
{ query: {} }
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'passes the search definition in the body' do
|
114
|
-
expect(client_double.mlt(index: 'foo', type: 'bar', id: '1', body: { query: {} })).to eq({})
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#mpercolate' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'GET',
|
8
|
-
'_mpercolate',
|
9
|
-
params,
|
10
|
-
body
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:body) do
|
15
|
-
nil
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:params) do
|
19
|
-
{}
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when a body is provided as a document' do
|
23
|
-
|
24
|
-
let(:body) do
|
25
|
-
"{\"percolate\":{\"index\":\"my-index\",\"type\":\"my-type\"}}\n{\"doc\":{\"message\":\"foo bar\"}}\n" +
|
26
|
-
"{\"percolate\":{\"index\":\"my-other-index\",\"type\":\"my-other-type\",\"id\":\"1\"}}\n{}\n"
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'performs the request' do
|
30
|
-
expect(client_double.mpercolate(body: [
|
31
|
-
{ percolate: { index: "my-index", type: "my-type" } },
|
32
|
-
{ doc: { message: "foo bar" } },
|
33
|
-
{ percolate: { index: "my-other-index", type: "my-other-type", id: "1" } },
|
34
|
-
{ }
|
35
|
-
])).to eq({})
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'when a body is provided as a string' do
|
40
|
-
|
41
|
-
let(:body) do
|
42
|
-
%Q|{"foo":"bar"}\n{"moo":"lam"}|
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'performs the request' do
|
46
|
-
expect(client_double.mpercolate(body: %Q|{"foo":"bar"}\n{"moo":"lam"}|)).to eq({})
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.nodes#shutdown' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'POST',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
nil,
|
11
|
-
nil
|
12
|
-
]
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:url) do
|
16
|
-
'_cluster/nodes/_shutdown'
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'performs the request' do
|
20
|
-
expect(client_double.nodes.shutdown).to eq({})
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:params) do
|
24
|
-
{}
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'when the node id is specified' do
|
28
|
-
|
29
|
-
let(:url) do
|
30
|
-
'_cluster/nodes/foo/_shutdown'
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'performs the request' do
|
34
|
-
expect(client_double.nodes.shutdown(node_id: 'foo')).to eq({})
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'when multiple node ids are specified as a list' do
|
39
|
-
|
40
|
-
let(:url) do
|
41
|
-
'_cluster/nodes/A,B,C/_shutdown'
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'performs the request' do
|
45
|
-
expect(client_double.nodes.shutdown(node_id: ['A', 'B', 'C'])).to eq({})
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'when multiple node ids are specified as a String' do
|
50
|
-
|
51
|
-
let(:url) do
|
52
|
-
'_cluster/nodes/A,B,C/_shutdown'
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'performs the request' do
|
56
|
-
expect(client_double.nodes.shutdown(node_id: 'A,B,C')).to eq({})
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#percolate' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'GET',
|
8
|
-
url,
|
9
|
-
{ },
|
10
|
-
body
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:body) do
|
15
|
-
{ doc: { foo: 'bar' }}
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:url) do
|
19
|
-
'foo/bar/_percolate'
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:client) do
|
23
|
-
Class.new { include Elasticsearch::API }.new
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'requires the :index argument' do
|
27
|
-
expect {
|
28
|
-
client.percolate(type: 'bar', body: {})
|
29
|
-
}.to raise_exception(ArgumentError)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'requires the :type argument' do
|
33
|
-
expect {
|
34
|
-
client.percolate(index: 'foo', body: {})
|
35
|
-
}.to raise_exception(ArgumentError)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'performs the request' do
|
39
|
-
expect(client_double.percolate(index: 'foo', type: 'bar', body: { doc: { foo: 'bar' } })).to eq({})
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'when the request needs to be URL-escaped' do
|
43
|
-
|
44
|
-
let(:url) do
|
45
|
-
'foo%5Ebar/bar%2Fbam/_percolate'
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'URL-escapes the parts' do
|
49
|
-
expect(client_double.percolate(index: 'foo^bar', type: 'bar/bam', body: { doc: { foo: 'bar' } })).to eq({})
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when the document id needs to be URL-escaped' do
|
54
|
-
|
55
|
-
let(:url) do
|
56
|
-
'foo%5Ebar/bar%2Fbam/some%2Fid/_percolate'
|
57
|
-
end
|
58
|
-
|
59
|
-
let(:body) do
|
60
|
-
nil
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'URL-escapes the id' do
|
64
|
-
expect(client_double.percolate(index: 'foo^bar', type: 'bar/bam', id: 'some/id')).to eq({})
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#put_template' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'POST',
|
8
|
-
'_scripts/foo',
|
9
|
-
{ },
|
10
|
-
{ }
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'performs the request' do
|
15
|
-
expect(client_double.put_template(id: 'foo', body: { })).to eq({})
|
16
|
-
end
|
17
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client.remote#info' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'GET',
|
8
|
-
'_remote/info',
|
9
|
-
{},
|
10
|
-
nil,
|
11
|
-
nil
|
12
|
-
]
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'performs the request' do
|
16
|
-
expect(client_double.remote.info).to eq({})
|
17
|
-
end
|
18
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#search_exists' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'POST',
|
8
|
-
'_search/exists',
|
9
|
-
{ q: 'foo' },
|
10
|
-
nil
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'performs the request' do
|
15
|
-
expect(client_double.search_exists(q: 'foo')).to eq({})
|
16
|
-
end
|
17
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'client#suggest' do
|
4
|
-
|
5
|
-
let(:expected_args) do
|
6
|
-
[
|
7
|
-
'POST',
|
8
|
-
url,
|
9
|
-
params,
|
10
|
-
body
|
11
|
-
]
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:url) do
|
15
|
-
'_suggest'
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:params) do
|
19
|
-
{}
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:body) do
|
23
|
-
{}
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'performs the request' do
|
27
|
-
expect(client_double.suggest(body: {})).to eq({})
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'when an index is specified' do
|
31
|
-
|
32
|
-
let(:url) do
|
33
|
-
'foo/_suggest'
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'performs the request' do
|
37
|
-
expect(client_double.suggest(index: 'foo', body: {}))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'when there are URL params specified' do
|
42
|
-
|
43
|
-
let(:url) do
|
44
|
-
'foo/_suggest'
|
45
|
-
end
|
46
|
-
|
47
|
-
let(:params) do
|
48
|
-
{ routing: 'abc123' }
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'performs the request' do
|
52
|
-
expect(client_double.suggest(index: 'foo', routing: 'abc123', body: {}))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'when the request must be URL-escaped' do
|
57
|
-
|
58
|
-
let(:url) do
|
59
|
-
'foo%5Ebar/_suggest'
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'performs the request' do
|
63
|
-
expect(client_double.suggest(index: 'foo^bar', body: {}))
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'when the request definition is specified in the body' do
|
68
|
-
|
69
|
-
let(:body) do
|
70
|
-
{ my_suggest: { text: 'test' } }
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'performs the request' do
|
74
|
-
expect(client_double.suggest(body: { my_suggest: { text: 'test' } } ))
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|