elasticsearch-api 7.8.0.pre → 7.10.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.md +18 -2
- data/elasticsearch-api.gemspec +2 -2
- data/lib/elasticsearch/api.rb +2 -1
- data/lib/elasticsearch/api/actions/bulk.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/aliases.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/allocation.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/count.rb +3 -3
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +4 -7
- data/lib/elasticsearch/api/actions/cat/health.rb +3 -5
- data/lib/elasticsearch/api/actions/cat/help.rb +2 -2
- data/lib/elasticsearch/api/actions/cat/indices.rb +7 -15
- data/lib/elasticsearch/api/actions/cat/master.rb +2 -2
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +2 -2
- data/lib/elasticsearch/api/actions/cat/nodes.rb +5 -9
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +3 -5
- data/lib/elasticsearch/api/actions/cat/plugins.rb +2 -2
- data/lib/elasticsearch/api/actions/cat/recovery.rb +5 -10
- data/lib/elasticsearch/api/actions/cat/repositories.rb +2 -2
- data/lib/elasticsearch/api/actions/cat/segments.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/shards.rb +5 -9
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/tasks.rb +3 -5
- data/lib/elasticsearch/api/actions/cat/templates.rb +3 -3
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +4 -6
- data/lib/elasticsearch/api/actions/clear_scroll.rb +4 -4
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +9 -4
- data/lib/elasticsearch/api/actions/cluster/delete_component_template.rb +6 -2
- data/lib/elasticsearch/api/actions/cluster/delete_voting_config_exclusions.rb +2 -2
- data/lib/elasticsearch/api/actions/cluster/exists_component_template.rb +6 -2
- data/lib/elasticsearch/api/actions/cluster/get_component_template.rb +7 -3
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +2 -2
- data/lib/elasticsearch/api/actions/cluster/health.rb +7 -15
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +2 -2
- data/lib/elasticsearch/api/actions/cluster/post_voting_config_exclusions.rb +2 -2
- data/lib/elasticsearch/api/actions/cluster/put_component_template.rb +6 -2
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +2 -2
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +2 -2
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +3 -5
- data/lib/elasticsearch/api/actions/cluster/state.rb +5 -9
- data/lib/elasticsearch/api/actions/cluster/stats.rb +3 -3
- data/lib/elasticsearch/api/actions/count.rb +11 -20
- data/lib/elasticsearch/api/actions/create.rb +5 -9
- data/lib/elasticsearch/api/actions/dangling_indices/delete_dangling_index.rb +60 -0
- data/lib/elasticsearch/api/actions/dangling_indices/import_dangling_index.rb +60 -0
- data/lib/elasticsearch/api/actions/{indices/get_data_streams.rb → dangling_indices/list_dangling_indices.rb} +6 -13
- data/lib/elasticsearch/api/actions/dangling_indices/params_registry.rb +60 -0
- data/lib/elasticsearch/api/actions/delete.rb +6 -10
- data/lib/elasticsearch/api/actions/delete_by_query.rb +8 -16
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +3 -3
- data/lib/elasticsearch/api/actions/delete_script.rb +2 -2
- data/lib/elasticsearch/api/actions/exists.rb +5 -7
- data/lib/elasticsearch/api/actions/exists_source.rb +5 -7
- data/lib/elasticsearch/api/actions/explain.rb +14 -11
- data/lib/elasticsearch/api/actions/field_caps.rb +15 -11
- data/lib/elasticsearch/api/actions/get.rb +5 -7
- data/lib/elasticsearch/api/actions/get_script.rb +2 -2
- data/lib/elasticsearch/api/actions/get_script_context.rb +6 -2
- data/lib/elasticsearch/api/actions/get_script_languages.rb +6 -2
- data/lib/elasticsearch/api/actions/get_source.rb +5 -7
- data/lib/elasticsearch/api/actions/index.rb +10 -14
- data/lib/elasticsearch/api/actions/indices/add_block.rb +68 -0
- data/lib/elasticsearch/api/actions/indices/analyze.rb +12 -8
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +4 -7
- data/lib/elasticsearch/api/actions/indices/clone.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/close.rb +3 -5
- data/lib/elasticsearch/api/actions/indices/create.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/delete.rb +3 -5
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +3 -3
- data/lib/elasticsearch/api/actions/indices/delete_index_template.rb +6 -2
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/exists.rb +3 -5
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/exists_index_template.rb +6 -2
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +3 -5
- data/lib/elasticsearch/api/actions/indices/flush.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +9 -6
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/get.rb +3 -5
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +5 -7
- data/lib/elasticsearch/api/actions/indices/get_index_template.rb +7 -3
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +6 -8
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/get_template.rb +3 -3
- data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/open.rb +3 -5
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +3 -3
- data/lib/elasticsearch/api/actions/indices/put_index_template.rb +6 -2
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +8 -8
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/put_template.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/recovery.rb +3 -3
- data/lib/elasticsearch/api/actions/indices/refresh.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/{delete_data_stream.rb → resolve_index.rb} +20 -8
- data/lib/elasticsearch/api/actions/indices/rollover.rb +3 -3
- data/lib/elasticsearch/api/actions/indices/segments.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +5 -9
- data/lib/elasticsearch/api/actions/indices/shrink.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/simulate_index_template.rb +6 -2
- data/lib/elasticsearch/api/actions/indices/simulate_template.rb +67 -0
- data/lib/elasticsearch/api/actions/indices/split.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/stats.rb +5 -11
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +2 -2
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +4 -6
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +17 -16
- data/lib/elasticsearch/api/actions/info.rb +2 -2
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +2 -2
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +3 -3
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +2 -2
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +2 -2
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +4 -4
- data/lib/elasticsearch/api/actions/mget.rb +5 -5
- data/lib/elasticsearch/api/actions/msearch.rb +8 -12
- data/lib/elasticsearch/api/actions/msearch_template.rb +6 -8
- data/lib/elasticsearch/api/actions/mtermvectors.rb +16 -13
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +4 -6
- data/lib/elasticsearch/api/actions/nodes/info.rb +4 -6
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +3 -3
- data/lib/elasticsearch/api/actions/nodes/stats.rb +6 -12
- data/lib/elasticsearch/api/actions/nodes/usage.rb +4 -6
- data/lib/elasticsearch/api/actions/ping.rb +2 -2
- data/lib/elasticsearch/api/actions/put_script.rb +3 -4
- data/lib/elasticsearch/api/actions/rank_eval.rb +10 -10
- data/lib/elasticsearch/api/actions/reindex.rb +2 -2
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +3 -3
- data/lib/elasticsearch/api/actions/render_search_template.rb +12 -7
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +13 -4
- data/lib/elasticsearch/api/actions/scroll.rb +13 -9
- data/lib/elasticsearch/api/actions/search.rb +18 -21
- data/lib/elasticsearch/api/actions/search_shards.rb +4 -6
- data/lib/elasticsearch/api/actions/search_template.rb +6 -10
- data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/clone.rb +66 -0
- data/lib/elasticsearch/api/actions/snapshot/create.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/get.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +3 -3
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +2 -2
- data/lib/elasticsearch/api/actions/snapshot/status.rb +3 -3
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +2 -2
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +3 -3
- data/lib/elasticsearch/api/actions/tasks/get.rb +2 -2
- data/lib/elasticsearch/api/actions/tasks/list.rb +3 -5
- data/lib/elasticsearch/api/actions/termvectors.rb +10 -8
- data/lib/elasticsearch/api/actions/update.rb +8 -8
- data/lib/elasticsearch/api/actions/update_by_query.rb +8 -16
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +3 -3
- data/lib/elasticsearch/api/namespace/cat.rb +0 -1
- data/lib/elasticsearch/api/namespace/dangling_indices.rb +35 -0
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/actions/count_spec.rb +2 -2
- data/spec/elasticsearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb +48 -0
- data/spec/elasticsearch/api/actions/dangling_indices/import_dangling_indices_spec.rb +48 -0
- data/spec/elasticsearch/api/actions/dangling_indices/list_dangling_indices_spec.rb +36 -0
- data/spec/elasticsearch/api/actions/explain_document_spec.rb +8 -9
- data/spec/elasticsearch/api/actions/indices/add_block_spec.rb +63 -0
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +7 -8
- data/spec/elasticsearch/api/actions/indices/validate_query_spec.rb +7 -13
- data/spec/elasticsearch/api/actions/ingest/simulate_spec.rb +6 -7
- data/spec/elasticsearch/api/actions/json_builders_spec.rb +10 -13
- data/spec/elasticsearch/api/actions/mget_spec.rb +5 -6
- data/spec/elasticsearch/api/actions/msearch_spec.rb +21 -39
- data/spec/elasticsearch/api/actions/msearch_template_spec.rb +5 -6
- data/spec/elasticsearch/api/actions/mtermvectors_spec.rb +7 -7
- data/spec/elasticsearch/api/actions/render_search_template_spec.rb +2 -2
- data/spec/elasticsearch/api/actions/scroll_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/search_spec.rb +7 -7
- data/spec/elasticsearch/api/actions/search_template_spec.rb +5 -6
- data/spec/elasticsearch/api/actions/snapshot/clone_spec.rb +67 -0
- data/spec/elasticsearch/api/actions/termvectors_spec.rb +5 -7
- data/spec/elasticsearch/api/rest_api_yaml_spec.rb +0 -1
- data/utils/thor/.rubocop.yml +2 -0
- data/utils/thor/generate_source.rb +54 -19
- data/utils/thor/generator/endpoint_specifics.rb +10 -3
- data/utils/thor/templates/_documentation_top.erb +13 -2
- metadata +24 -13
- data/lib/elasticsearch/api/actions/indices/create_data_stream.rb +0 -50
- data/spec/README.md +0 -61
- data/test/integration/yaml_test_runner.rb +0 -592
- data/test/test_helper.rb +0 -118
@@ -18,14 +18,13 @@
|
|
18
18
|
require 'spec_helper'
|
19
19
|
|
20
20
|
describe 'client#msearch' do
|
21
|
-
|
22
21
|
let(:expected_args) do
|
23
22
|
[
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
'POST',
|
24
|
+
url,
|
25
|
+
params,
|
26
|
+
body,
|
27
|
+
headers
|
29
28
|
]
|
30
29
|
end
|
31
30
|
|
@@ -50,13 +49,12 @@ describe 'client#msearch' do
|
|
50
49
|
end
|
51
50
|
|
52
51
|
it 'requires the :body argument' do
|
53
|
-
expect
|
52
|
+
expect do
|
54
53
|
client.msearch
|
55
|
-
|
54
|
+
end.to raise_exception(ArgumentError)
|
56
55
|
end
|
57
56
|
|
58
57
|
context 'when the body is an object' do
|
59
|
-
|
60
58
|
let(:body) do
|
61
59
|
<<-PAYLOAD.gsub(/^\s+/, '')
|
62
60
|
{"index":"foo"}
|
@@ -69,16 +67,19 @@ describe 'client#msearch' do
|
|
69
67
|
end
|
70
68
|
|
71
69
|
it 'performs the request' do
|
72
|
-
expect(
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
expect(
|
71
|
+
client_double.msearch(
|
72
|
+
body: [
|
73
|
+
{ index: 'foo', search: { query: { match_all: {} } } },
|
74
|
+
{ index: 'bar', search: { query: { match: { foo: 'bar' } } } },
|
75
|
+
{ search_type: 'count', search: { facets: { tags: {} } } }
|
76
|
+
]
|
77
|
+
)
|
78
|
+
)
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
80
82
|
context 'when the body is a string' do
|
81
|
-
|
82
83
|
let(:body) do
|
83
84
|
%Q|{"foo":"bar"}\n{"moo":"lam"}|
|
84
85
|
end
|
@@ -89,7 +90,6 @@ describe 'client#msearch' do
|
|
89
90
|
end
|
90
91
|
|
91
92
|
context 'when an index is specified' do
|
92
|
-
|
93
93
|
let(:url) do
|
94
94
|
'foo/_msearch'
|
95
95
|
end
|
@@ -103,10 +103,9 @@ describe 'client#msearch' do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
context 'when
|
107
|
-
|
106
|
+
context 'when multiple indices are specified' do
|
108
107
|
let(:url) do
|
109
|
-
'foo
|
108
|
+
'foo,bar/_msearch'
|
110
109
|
end
|
111
110
|
|
112
111
|
let(:body) do
|
@@ -114,29 +113,13 @@ describe 'client#msearch' do
|
|
114
113
|
end
|
115
114
|
|
116
115
|
it 'performs the request' do
|
117
|
-
expect(client_double.msearch(index: 'foo',
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context 'when multiple indices and multiple types are specified' do
|
122
|
-
|
123
|
-
let(:url) do
|
124
|
-
'foo,bar/lam,bam/_msearch'
|
125
|
-
end
|
126
|
-
|
127
|
-
let(:body) do
|
128
|
-
''
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'performs the request' do
|
132
|
-
expect(client_double.msearch(index: ['foo', 'bar'], type: ['lam', 'bam'], body: []))
|
116
|
+
expect(client_double.msearch(index: ['foo', 'bar'], body: []))
|
133
117
|
end
|
134
118
|
end
|
135
119
|
|
136
120
|
context 'when the request needs to be URL-escaped' do
|
137
|
-
|
138
121
|
let(:url) do
|
139
|
-
'foo%5Ebar/
|
122
|
+
'foo%5Ebar/_msearch'
|
140
123
|
end
|
141
124
|
|
142
125
|
let(:body) do
|
@@ -144,12 +127,11 @@ describe 'client#msearch' do
|
|
144
127
|
end
|
145
128
|
|
146
129
|
it 'performs the request' do
|
147
|
-
expect(client_double.msearch(index: 'foo^bar',
|
130
|
+
expect(client_double.msearch(index: 'foo^bar', body: [])).to eq({})
|
148
131
|
end
|
149
132
|
end
|
150
133
|
|
151
134
|
context 'when the URL params need to be URL-encoded' do
|
152
|
-
|
153
135
|
let(:url) do
|
154
136
|
'_msearch'
|
155
137
|
end
|
@@ -18,16 +18,16 @@
|
|
18
18
|
require 'spec_helper'
|
19
19
|
|
20
20
|
describe 'client#mtermvectors' do
|
21
|
-
|
22
21
|
let(:expected_args) do
|
23
22
|
[
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
method,
|
24
|
+
'my-index/my-type/_mtermvectors',
|
25
|
+
{},
|
26
|
+
body,
|
27
|
+
{}
|
29
28
|
]
|
30
29
|
end
|
30
|
+
let(:method) { 'POST' }
|
31
31
|
|
32
32
|
let(:body) do
|
33
33
|
{ ids: [1, 2, 3] }
|
@@ -38,7 +38,7 @@ describe 'client#mtermvectors' do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
context 'when a list of ids is passed instead of a body' do
|
41
|
-
|
41
|
+
let(:method) { 'GET' }
|
42
42
|
it 'performs the request' do
|
43
43
|
expect(client_double.mtermvectors(index: 'my-index', type: 'my-type', ids: [1, 2, 3])).to eq({})
|
44
44
|
end
|
@@ -21,7 +21,7 @@ describe 'client#render_search_template' do
|
|
21
21
|
context 'when no id is specified' do
|
22
22
|
let(:expected_args) do
|
23
23
|
[
|
24
|
-
'
|
24
|
+
'POST',
|
25
25
|
'_render/template',
|
26
26
|
{},
|
27
27
|
{ foo: 'bar' },
|
@@ -37,7 +37,7 @@ describe 'client#render_search_template' do
|
|
37
37
|
context 'when id is specified' do
|
38
38
|
let(:expected_args) do
|
39
39
|
[
|
40
|
-
'
|
40
|
+
'POST',
|
41
41
|
'_render/template/foo',
|
42
42
|
{},
|
43
43
|
{ foo: 'bar' },
|
@@ -18,16 +18,16 @@
|
|
18
18
|
require 'spec_helper'
|
19
19
|
|
20
20
|
describe 'client#search' do
|
21
|
-
|
22
21
|
let(:expected_args) do
|
23
22
|
[
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
method,
|
24
|
+
url,
|
25
|
+
params,
|
26
|
+
body,
|
27
|
+
{}
|
29
28
|
]
|
30
29
|
end
|
30
|
+
let(:method) { 'GET' }
|
31
31
|
|
32
32
|
let(:body) do
|
33
33
|
nil
|
@@ -46,10 +46,10 @@ describe 'client#search' do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context 'when a request definition is specified' do
|
49
|
-
|
50
49
|
let(:body) do
|
51
50
|
{ query: { match: {} } }
|
52
51
|
end
|
52
|
+
let(:method) { 'POST' }
|
53
53
|
|
54
54
|
let(:url) do
|
55
55
|
'_search'
|
@@ -18,14 +18,13 @@
|
|
18
18
|
require 'spec_helper'
|
19
19
|
|
20
20
|
describe 'client#search_template' do
|
21
|
-
|
22
21
|
let(:expected_args) do
|
23
22
|
[
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
'POST',
|
24
|
+
'foo/_search/template',
|
25
|
+
{ },
|
26
|
+
{ foo: 'bar' },
|
27
|
+
{}
|
29
28
|
]
|
30
29
|
end
|
31
30
|
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
require 'spec_helper'
|
19
|
+
|
20
|
+
describe 'client.snapshot#clone' do
|
21
|
+
let(:expected_args) do
|
22
|
+
[
|
23
|
+
'PUT',
|
24
|
+
'_snapshot/foo/bar/_clone/snapshot',
|
25
|
+
{},
|
26
|
+
{},
|
27
|
+
{}
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:client) do
|
32
|
+
Class.new { include Elasticsearch::API }.new
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'requires the :body argument' do
|
36
|
+
expect {
|
37
|
+
client.snapshot.clone(snapshot: 'bar')
|
38
|
+
}.to raise_exception(ArgumentError)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'requires the :repository argument' do
|
42
|
+
expect {
|
43
|
+
client.snapshot.clone(snapshot: 'foo', body: {})
|
44
|
+
}.to raise_exception(ArgumentError)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'requires the :snapshot argument' do
|
48
|
+
expect {
|
49
|
+
client.snapshot.clone(repository: 'foo', body: {})
|
50
|
+
}.to raise_exception(ArgumentError)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'requires the :target_snapshot argument' do
|
54
|
+
expect {
|
55
|
+
client.snapshot.clone(repository: 'foo', body: {}, snapshot: 'bar')
|
56
|
+
}.to raise_exception(ArgumentError)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'performs the request' do
|
60
|
+
expect(client_double.snapshot.clone(
|
61
|
+
repository: 'foo',
|
62
|
+
snapshot: 'bar',
|
63
|
+
body: {},
|
64
|
+
target_snapshot: 'snapshot'
|
65
|
+
)).to eq({})
|
66
|
+
end
|
67
|
+
end
|
@@ -18,14 +18,13 @@
|
|
18
18
|
require 'spec_helper'
|
19
19
|
|
20
20
|
describe 'client#termvectors' do
|
21
|
-
|
22
21
|
let(:expected_args) do
|
23
22
|
[
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
'POST',
|
24
|
+
url,
|
25
|
+
params,
|
26
|
+
body,
|
27
|
+
{}
|
29
28
|
]
|
30
29
|
end
|
31
30
|
|
@@ -56,7 +55,6 @@ describe 'client#termvectors' do
|
|
56
55
|
end
|
57
56
|
|
58
57
|
context 'when the older api name \'termvector\' is used' do
|
59
|
-
|
60
58
|
let(:url) do
|
61
59
|
'foo/bar/123/_termvector'
|
62
60
|
end
|
@@ -50,6 +50,7 @@ module Elasticsearch
|
|
50
50
|
method_option :verbose, type: :boolean, default: false, desc: 'Output more information'
|
51
51
|
method_option :tests, type: :boolean, default: false, desc: 'Generate test files'
|
52
52
|
method_option :api, type: :array, default: %w[oss xpack], desc: 'APIs to generate (oss, x-pack)'
|
53
|
+
|
53
54
|
def generate
|
54
55
|
self.class.source_root File.expand_path(__dir__)
|
55
56
|
@xpack = options[:api].include? 'xpack'
|
@@ -113,12 +114,13 @@ module Elasticsearch
|
|
113
114
|
names = @endpoint_name.split('.')
|
114
115
|
if @current_api == :xpack
|
115
116
|
names = (names.first == 'xpack' ? names : ['xpack', names].flatten)
|
116
|
-
# Return an array
|
117
|
-
# 'index_lifecycle_management'
|
117
|
+
# Return an array to expand 'ccr', 'ilm', 'ml' and 'slm'
|
118
118
|
names.map do |name|
|
119
119
|
name
|
120
120
|
.gsub(/^ml$/, 'machine_learning')
|
121
121
|
.gsub(/^ilm$/, 'index_lifecycle_management')
|
122
|
+
.gsub(/^ccr/, 'cross_cluster_replication')
|
123
|
+
.gsub(/^slm/, 'snapshot_lifecycle_management')
|
122
124
|
end
|
123
125
|
else
|
124
126
|
names
|
@@ -146,19 +148,24 @@ module Elasticsearch
|
|
146
148
|
end
|
147
149
|
|
148
150
|
def __http_method
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
151
|
+
return '_id ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST' if @endpoint_name == 'index'
|
152
|
+
|
153
|
+
default_method = @spec['url']['paths'].map { |a| a['methods'] }.flatten.first
|
154
|
+
if @spec['body'] && default_method == 'GET'
|
155
|
+
# When default method is GET and body is required, we should always use POST
|
156
|
+
if @spec['body']['required']
|
157
|
+
'Elasticsearch::API::HTTP_POST'
|
158
|
+
else
|
159
|
+
<<~SRC
|
160
|
+
if arguments[:body]
|
161
|
+
Elasticsearch::API::HTTP_POST
|
162
|
+
else
|
163
|
+
Elasticsearch::API::HTTP_GET
|
164
|
+
end
|
165
|
+
SRC
|
166
|
+
end
|
160
167
|
else
|
161
|
-
"Elasticsearch::API::HTTP_#{
|
168
|
+
"Elasticsearch::API::HTTP_#{default_method}"
|
162
169
|
end
|
163
170
|
end
|
164
171
|
|
@@ -222,10 +229,38 @@ module Elasticsearch
|
|
222
229
|
info['type'] = 'String' if info['type'] == 'enum' # Rename 'enums' to 'strings'
|
223
230
|
tipo = info['type'] ? info['type'].capitalize : 'String'
|
224
231
|
description = info['description'] ? info['description'].strip : '[TODO]'
|
225
|
-
options = info['options'] ? "
|
226
|
-
required = info['required'] ? '
|
227
|
-
deprecated = info['deprecated'] ? '
|
228
|
-
|
232
|
+
options = info['options'] ? "(options: #{info['options'].join(', ').strip})" : nil
|
233
|
+
required = info['required'] ? '(*Required*)' : ''
|
234
|
+
deprecated = info['deprecated'] ? '*Deprecated*' : ''
|
235
|
+
optionals = [required, deprecated, options].join(' ').strip
|
236
|
+
|
237
|
+
"# @option arguments [#{tipo}] :#{name} #{description} #{optionals}\n"
|
238
|
+
end
|
239
|
+
|
240
|
+
def stability_doc_helper(stability)
|
241
|
+
return if stability == 'stable'
|
242
|
+
|
243
|
+
if stability == 'experimental'
|
244
|
+
<<~MSG
|
245
|
+
# This functionality is Experimental and may be changed or removed
|
246
|
+
# completely in a future release. Elastic will take a best effort approach
|
247
|
+
# to fix any issues, but experimental features are not subject to the
|
248
|
+
# support SLA of official GA features.
|
249
|
+
MSG
|
250
|
+
elsif stability == 'beta'
|
251
|
+
<<~MSG
|
252
|
+
# This functionality is in Beta and is subject to change. The design and
|
253
|
+
# code is less mature than official GA features and is being provided
|
254
|
+
# as-is with no warranties. Beta features are not subject to the support
|
255
|
+
# SLA of official GA features.
|
256
|
+
MSG
|
257
|
+
else
|
258
|
+
<<~MSG
|
259
|
+
# This functionality is subject to potential breaking changes within a
|
260
|
+
# minor version, meaning that your referencing code may break when this
|
261
|
+
# library is upgraded.
|
262
|
+
MSG
|
263
|
+
end
|
229
264
|
end
|
230
265
|
|
231
266
|
def generate_tests
|
@@ -260,7 +295,7 @@ module Elasticsearch
|
|
260
295
|
end
|
261
296
|
|
262
297
|
def run_rubocop(api)
|
263
|
-
system("rubocop --format autogenconf -x #{FilesHelper::output_dir(api)}")
|
298
|
+
system("rubocop -c ./thor/.rubocop.yml --format autogenconf -x #{FilesHelper::output_dir(api)}")
|
264
299
|
end
|
265
300
|
end
|
266
301
|
end
|