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.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -1
  3. data/lib/elasticsearch/api/actions/benchmark.rb +1 -1
  4. data/lib/elasticsearch/api/actions/bulk.rb +4 -6
  5. data/lib/elasticsearch/api/actions/cat/aliases.rb +10 -10
  6. data/lib/elasticsearch/api/actions/cat/allocation.rb +11 -11
  7. data/lib/elasticsearch/api/actions/cat/count.rb +10 -10
  8. data/lib/elasticsearch/api/actions/cat/fielddata.rb +9 -7
  9. data/lib/elasticsearch/api/actions/cat/health.rb +11 -11
  10. data/lib/elasticsearch/api/actions/cat/help.rb +4 -2
  11. data/lib/elasticsearch/api/actions/cat/indices.rb +14 -15
  12. data/lib/elasticsearch/api/actions/cat/master.rb +10 -10
  13. data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +6 -4
  14. data/lib/elasticsearch/api/actions/cat/nodes.rb +10 -10
  15. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +10 -10
  16. data/lib/elasticsearch/api/actions/cat/plugins.rb +7 -6
  17. data/lib/elasticsearch/api/actions/cat/recovery.rb +10 -12
  18. data/lib/elasticsearch/api/actions/cat/repositories.rb +7 -3
  19. data/lib/elasticsearch/api/actions/cat/segments.rb +9 -7
  20. data/lib/elasticsearch/api/actions/cat/shards.rb +12 -12
  21. data/lib/elasticsearch/api/actions/cat/snapshots.rb +8 -4
  22. data/lib/elasticsearch/api/actions/cat/tasks.rb +4 -6
  23. data/lib/elasticsearch/api/actions/cat/templates.rb +6 -6
  24. data/lib/elasticsearch/api/actions/cat/thread_pool.rb +13 -17
  25. data/lib/elasticsearch/api/actions/clear_scroll.rb +7 -0
  26. data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +2 -3
  27. data/lib/elasticsearch/api/actions/cluster/get_settings.rb +5 -2
  28. data/lib/elasticsearch/api/actions/cluster/health.rb +11 -20
  29. data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +2 -3
  30. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +8 -3
  31. data/lib/elasticsearch/api/actions/cluster/remote_info.rb +7 -1
  32. data/lib/elasticsearch/api/actions/cluster/reroute.rb +7 -7
  33. data/lib/elasticsearch/api/actions/cluster/state.rb +18 -15
  34. data/lib/elasticsearch/api/actions/cluster/stats.rb +12 -5
  35. data/lib/elasticsearch/api/actions/count.rb +12 -23
  36. data/lib/elasticsearch/api/actions/count_percolate.rb +1 -1
  37. data/lib/elasticsearch/api/actions/delete.rb +16 -8
  38. data/lib/elasticsearch/api/actions/delete_by_query.rb +7 -9
  39. data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +29 -0
  40. data/lib/elasticsearch/api/actions/delete_script.rb +5 -6
  41. data/lib/elasticsearch/api/actions/exists.rb +3 -4
  42. data/lib/elasticsearch/api/actions/exists_source.rb +51 -0
  43. data/lib/elasticsearch/api/actions/explain.rb +11 -25
  44. data/lib/elasticsearch/api/actions/field_caps.rb +2 -2
  45. data/lib/elasticsearch/api/actions/get.rb +13 -19
  46. data/lib/elasticsearch/api/actions/get_script.rb +9 -2
  47. data/lib/elasticsearch/api/actions/get_source.rb +10 -14
  48. data/lib/elasticsearch/api/actions/index.rb +10 -16
  49. data/lib/elasticsearch/api/actions/indices/analyze.rb +3 -27
  50. data/lib/elasticsearch/api/actions/indices/clear_cache.rb +2 -4
  51. data/lib/elasticsearch/api/actions/indices/close.rb +9 -15
  52. data/lib/elasticsearch/api/actions/indices/create.rb +7 -7
  53. data/lib/elasticsearch/api/actions/indices/delete.rb +3 -4
  54. data/lib/elasticsearch/api/actions/indices/delete_alias.rb +7 -4
  55. data/lib/elasticsearch/api/actions/indices/delete_template.rb +5 -2
  56. data/lib/elasticsearch/api/actions/indices/exists.rb +11 -17
  57. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +6 -14
  58. data/lib/elasticsearch/api/actions/indices/exists_template.rb +8 -4
  59. data/lib/elasticsearch/api/actions/indices/exists_type.rb +6 -15
  60. data/lib/elasticsearch/api/actions/indices/flush.rb +5 -9
  61. data/lib/elasticsearch/api/actions/indices/flush_synced.rb +1 -1
  62. data/lib/elasticsearch/api/actions/indices/forcemerge.rb +13 -11
  63. data/lib/elasticsearch/api/actions/indices/freeze.rb +0 -1
  64. data/lib/elasticsearch/api/actions/indices/get.rb +9 -15
  65. data/lib/elasticsearch/api/actions/indices/get_alias.rb +6 -14
  66. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +11 -15
  67. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +12 -16
  68. data/lib/elasticsearch/api/actions/indices/get_settings.rb +12 -21
  69. data/lib/elasticsearch/api/actions/indices/get_template.rb +8 -5
  70. data/lib/elasticsearch/api/actions/indices/open.rb +9 -15
  71. data/lib/elasticsearch/api/actions/indices/put_alias.rb +6 -3
  72. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -23
  73. data/lib/elasticsearch/api/actions/indices/put_settings.rb +10 -20
  74. data/lib/elasticsearch/api/actions/indices/put_template.rb +10 -5
  75. data/lib/elasticsearch/api/actions/indices/recovery.rb +2 -4
  76. data/lib/elasticsearch/api/actions/indices/refresh.rb +6 -14
  77. data/lib/elasticsearch/api/actions/indices/rollover.rb +6 -5
  78. data/lib/elasticsearch/api/actions/indices/segments.rb +6 -14
  79. data/lib/elasticsearch/api/actions/indices/shard_stores.rb +2 -4
  80. data/lib/elasticsearch/api/actions/indices/shrink.rb +6 -7
  81. data/lib/elasticsearch/api/actions/indices/split.rb +2 -1
  82. data/lib/elasticsearch/api/actions/indices/update_aliases.rb +7 -4
  83. data/lib/elasticsearch/api/actions/indices/upgrade.rb +10 -13
  84. data/lib/elasticsearch/api/actions/indices/validate_query.rb +14 -25
  85. data/lib/elasticsearch/api/actions/info.rb +6 -0
  86. data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +1 -1
  87. data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +4 -3
  88. data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +29 -0
  89. data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +1 -1
  90. data/lib/elasticsearch/api/actions/ingest/simulate.rb +5 -5
  91. data/lib/elasticsearch/api/actions/mget.rb +8 -17
  92. data/lib/elasticsearch/api/actions/msearch.rb +7 -2
  93. data/lib/elasticsearch/api/actions/msearch_template.rb +8 -1
  94. data/lib/elasticsearch/api/actions/mtermvectors.rb +21 -22
  95. data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +4 -6
  96. data/lib/elasticsearch/api/actions/nodes/info.rb +6 -26
  97. data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +10 -4
  98. data/lib/elasticsearch/api/actions/nodes/stats.rb +11 -30
  99. data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -0
  100. data/lib/elasticsearch/api/actions/ping.rb +6 -0
  101. data/lib/elasticsearch/api/actions/put_script.rb +10 -9
  102. data/lib/elasticsearch/api/actions/rank_eval.rb +36 -0
  103. data/lib/elasticsearch/api/actions/reindex.rb +9 -14
  104. data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +29 -0
  105. data/lib/elasticsearch/api/actions/render_search_template.rb +1 -1
  106. data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +27 -0
  107. data/lib/elasticsearch/api/actions/scroll.rb +3 -2
  108. data/lib/elasticsearch/api/actions/search.rb +36 -53
  109. data/lib/elasticsearch/api/actions/search_shards.rb +7 -14
  110. data/lib/elasticsearch/api/actions/search_template.rb +20 -19
  111. data/lib/elasticsearch/api/actions/snapshot/create.rb +2 -3
  112. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +4 -3
  113. data/lib/elasticsearch/api/actions/snapshot/delete.rb +3 -3
  114. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +1 -2
  115. data/lib/elasticsearch/api/actions/snapshot/get.rb +3 -3
  116. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +3 -6
  117. data/lib/elasticsearch/api/actions/snapshot/restore.rb +1 -1
  118. data/lib/elasticsearch/api/actions/snapshot/status.rb +4 -5
  119. data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +1 -2
  120. data/lib/elasticsearch/api/actions/tasks/cancel.rb +7 -13
  121. data/lib/elasticsearch/api/actions/tasks/get.rb +6 -3
  122. data/lib/elasticsearch/api/actions/tasks/list.rb +10 -16
  123. data/lib/elasticsearch/api/actions/termvectors.rb +22 -21
  124. data/lib/elasticsearch/api/actions/update.rb +19 -33
  125. data/lib/elasticsearch/api/actions/update_by_query.rb +13 -33
  126. data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +29 -0
  127. data/lib/elasticsearch/api/version.rb +1 -1
  128. data/spec/elasticsearch/api/actions/cluster/state_spec.rb +0 -17
  129. data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +17 -0
  130. data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -37
  131. data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +0 -15
  132. data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +0 -15
  133. data/spec/elasticsearch/api/actions/indices/segments_spec.rb +0 -15
  134. data/spec/elasticsearch/api/actions/mget_spec.rb +0 -15
  135. data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
  136. data/test/integration/yaml_test_runner.rb +2 -4
  137. data/utils/thor/generate_source.rb +1 -0
  138. data/utils/thor/templates/ruby/method.erb +7 -5
  139. metadata +12 -73
  140. data/lib/elasticsearch/api/actions/delete_template.rb +0 -21
  141. data/lib/elasticsearch/api/actions/field_stats.rb +0 -36
  142. data/lib/elasticsearch/api/actions/get_template.rb +0 -27
  143. data/lib/elasticsearch/api/actions/indices/delete_mapping.rb +0 -26
  144. data/lib/elasticsearch/api/actions/indices/delete_warmer.rb +0 -32
  145. data/lib/elasticsearch/api/actions/indices/get_aliases.rb +0 -37
  146. data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -62
  147. data/lib/elasticsearch/api/actions/indices/optimize.rb +0 -77
  148. data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -65
  149. data/lib/elasticsearch/api/actions/indices/seal.rb +0 -24
  150. data/lib/elasticsearch/api/actions/indices/snapshot_index.rb +0 -44
  151. data/lib/elasticsearch/api/actions/indices/status.rb +0 -63
  152. data/lib/elasticsearch/api/actions/list_benchmarks.rb +0 -27
  153. data/lib/elasticsearch/api/actions/mlt.rb +0 -130
  154. data/lib/elasticsearch/api/actions/mpercolate.rb +0 -62
  155. data/lib/elasticsearch/api/actions/nodes/shutdown.rb +0 -39
  156. data/lib/elasticsearch/api/actions/percolate.rb +0 -73
  157. data/lib/elasticsearch/api/actions/put_template.rb +0 -25
  158. data/lib/elasticsearch/api/actions/remote/info.rb +0 -21
  159. data/lib/elasticsearch/api/actions/search_exists.rb +0 -63
  160. data/lib/elasticsearch/api/actions/suggest.rb +0 -49
  161. data/spec/elasticsearch/api/actions/delete_template_spec.rb +0 -17
  162. data/spec/elasticsearch/api/actions/field_stats_spec.rb +0 -17
  163. data/spec/elasticsearch/api/actions/get_template_spec.rb +0 -52
  164. data/spec/elasticsearch/api/actions/indices/delete_mapping_spec.rb +0 -77
  165. data/spec/elasticsearch/api/actions/indices/delete_warmer_spec.rb +0 -86
  166. data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +0 -68
  167. data/spec/elasticsearch/api/actions/indices/get_aliases_spec.rb +0 -55
  168. data/spec/elasticsearch/api/actions/indices/get_warmer_spec.rb +0 -48
  169. data/spec/elasticsearch/api/actions/indices/optimize_spec.rb +0 -63
  170. data/spec/elasticsearch/api/actions/indices/put_warmer_spec.rb +0 -101
  171. data/spec/elasticsearch/api/actions/indices/seal_spec.rb +0 -18
  172. data/spec/elasticsearch/api/actions/indices/snapshot_index_spec.rb +0 -89
  173. data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -108
  174. data/spec/elasticsearch/api/actions/indices/status_spec.rb +0 -92
  175. data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +0 -68
  176. data/spec/elasticsearch/api/actions/list_benchmarks_spec.rb +0 -17
  177. data/spec/elasticsearch/api/actions/mlt_spec.rb +0 -117
  178. data/spec/elasticsearch/api/actions/mpercolate_spec.rb +0 -49
  179. data/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb +0 -59
  180. data/spec/elasticsearch/api/actions/percolate_spec.rb +0 -67
  181. data/spec/elasticsearch/api/actions/put_template_spec.rb +0 -17
  182. data/spec/elasticsearch/api/actions/remote/info_spec.rb +0 -18
  183. data/spec/elasticsearch/api/actions/search_exists_spec.rb +0 -17
  184. 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,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'client#field_stats' do
4
-
5
- let(:expected_args) do
6
- [
7
- 'GET',
8
- '_field_stats',
9
- { },
10
- nil
11
- ]
12
- end
13
-
14
- it 'performs the request' do
15
- expect(client_double.field_stats).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