elasticsearch-api 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 554bf3603ac9c6be5fa3555e017babe35f101f15e2417013ed56f953afc865e3
4
- data.tar.gz: c478ddfc93e1229bffb91bbe0cb9997e74becde2c5105ed497780e7e4f7a2f59
3
+ metadata.gz: ecee794892845a6e8aabd3e013758290f63ebf2b140720e13975c21108480026
4
+ data.tar.gz: 11632fbccfa4f40915794e03cc9905333c627b2240bcd890f1f21f20e4c87e59
5
5
  SHA512:
6
- metadata.gz: 55e7282d4325fb747e51aec041f4e7aa86d20f5760ade1a060825db225500810f8ede807b94329ec1980bf5f7e938c233134f56361fc683378cde0bfdf8fe09d
7
- data.tar.gz: 773db2bfcf05d36b4e8a042f70a0e269c41a13bef8d785e90d38c8db3a3e96e8d8cf6aa40094d15ac97486fc0a24a74353e38c54fa6da6705935de5b153c694c
6
+ metadata.gz: 5ca7fd376ebee945913fe516b9672a0ef2ddf436e55b2503c76611a510d70686e741df67e5e4a38df4ec50bb57e4be47909fdc1f3c8b79c621df6449d7e03db2
7
+ data.tar.gz: 58198c72df28aca80aed6f59ec4e8e3f034ebd13b3368b50075e73d3c8f484e8f51b604df7b79b7210095fd97f0b032d7252dcac501520dd8d2734274c7fc026
@@ -0,0 +1,50 @@
1
+ # Licensed to Elasticsearch B.V under one or more agreements.
2
+ # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
+ # See the LICENSE file in the project root for more information
4
+
5
+ module Elasticsearch
6
+ module API
7
+ module Indices
8
+ module Actions
9
+
10
+ # Clone an existing index into a new index, where each original primary shard is cloned into a
11
+ # new primary shard in the new index.
12
+ #
13
+ # @example Clone index named _myindex_
14
+ #
15
+ # client.indices.clone(index: 'my_source_index', target: 'my_target_index')
16
+ #
17
+ # @option arguments [String] :index The name of the source index to clone (*Required*)
18
+ # @option arguments [String] :target The name of the target index to clone into (*Required*)
19
+ # @option arguments [Time] :timeout Explicit operation timeout
20
+ # @option arguments [Time] :master_timeout Specify timeout for connection to master
21
+ # @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on
22
+ # the cloned index before the operation returns.
23
+ # @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)
24
+ #
25
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html
26
+ #
27
+ def clone(arguments={})
28
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
29
+ raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]
30
+ method = HTTP_POST
31
+ arguments = arguments.clone
32
+
33
+ body = arguments.delete(:body)
34
+ path = Utils.__pathify(arguments.delete(:index), '_clone', arguments.delete(:target))
35
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
36
+
37
+ perform_request(method, path, params, body).body
38
+ end
39
+
40
+ # Register this action with its valid params when the module is loaded.
41
+ #
42
+ # @since 7.4.0
43
+ ParamsRegistry.register(:clone, [
44
+ :timeout,
45
+ :master_timeout,
46
+ :wait_for_active_shards ].freeze)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -11,7 +11,7 @@ module Elasticsearch
11
11
  #
12
12
  # @example Storing an Mvel script in Elasticsearch and using it in function score
13
13
  #
14
- # client.put_script lang: 'groovy', id: 'my_score', body: { script: 'log(_score * factor)' }
14
+ # client.put_script id: 'my_score', body: { script: { lang: 'groovy', source: 'log(_score * factor)' } }
15
15
  #
16
16
  # client.search body: {
17
17
  # query: {
@@ -4,6 +4,6 @@
4
4
 
5
5
  module Elasticsearch
6
6
  module API
7
- VERSION = "7.3.0"
7
+ VERSION = "7.4.0"
8
8
  end
9
9
  end
@@ -0,0 +1,109 @@
1
+ # Licensed to Elasticsearch B.V under one or more agreements.
2
+ # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
+ # See the LICENSE file in the project root for more information
4
+
5
+ require 'spec_helper'
6
+
7
+ describe 'client.indices#clone' do
8
+
9
+ let(:expected_args) do
10
+ [
11
+ 'POST',
12
+ url,
13
+ params,
14
+ body,
15
+ nil
16
+ ]
17
+ end
18
+
19
+ let(:params) do
20
+ {}
21
+ end
22
+
23
+ let(:body) do
24
+ nil
25
+ end
26
+
27
+ let(:url) do
28
+ 'my_source_index/_clone/my_target_index'
29
+ end
30
+
31
+ context 'when there is no index specified' do
32
+
33
+ let(:client) do
34
+ Class.new { include Elasticsearch::API }.new
35
+ end
36
+
37
+ it 'raises an exception' do
38
+ expect {
39
+ client.indices.clone(target: 'my_target_index')
40
+ }.to raise_exception(ArgumentError)
41
+ end
42
+ end
43
+
44
+ context 'when there is no index specified' do
45
+
46
+ let(:client) do
47
+ Class.new { include Elasticsearch::API }.new
48
+ end
49
+
50
+ it 'raises an exception' do
51
+ expect {
52
+ client.indices.clone(index: 'my_source_index')
53
+ }.to raise_exception(ArgumentError)
54
+ end
55
+ end
56
+
57
+ context 'when an index and target are specified' do
58
+
59
+ it 'performs the request' do
60
+ expect(client_double.indices.clone(index: 'my_source_index', target: 'my_target_index')).to eq({})
61
+ end
62
+ end
63
+
64
+ context 'when params are provided' do
65
+
66
+ let(:params) do
67
+ {
68
+ timeout: '1s',
69
+ master_timeout: '10s',
70
+ wait_for_active_shards: 1
71
+ }
72
+ end
73
+
74
+ it 'performs the request' do
75
+ expect(client_double.indices.clone(index: 'my_source_index',
76
+ target: 'my_target_index',
77
+ timeout: '1s',
78
+ master_timeout: '10s',
79
+ wait_for_active_shards: 1)).to eq({})
80
+ end
81
+ end
82
+
83
+ context 'when a body is specified' do
84
+
85
+ let(:body) do
86
+ {
87
+ settings: {
88
+ 'index.number_of_shards' => 5
89
+ },
90
+ aliases: {
91
+ my_search_indices: {}
92
+ }
93
+ }
94
+ end
95
+
96
+ it 'performs the request' do
97
+ expect(client_double.indices.clone(index: 'my_source_index',
98
+ target: 'my_target_index',
99
+ body: {
100
+ settings: {
101
+ 'index.number_of_shards' => 5
102
+ },
103
+ aliases: {
104
+ my_search_indices: {}
105
+ }
106
+ })).to eq({})
107
+ end
108
+ end
109
+ end
@@ -18,7 +18,7 @@ describe 'Rest API YAML tests' do
18
18
  context "#{test.description}" do
19
19
 
20
20
  if test.skip_test?(ADMIN_CLIENT)
21
- skip 'Test contains feature(s) not yet support or version is not satisfied'
21
+ skip 'Test contains feature(s) not yet supported or version is not satisfied'
22
22
 
23
23
  else
24
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.0
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-01 00:00:00.000000000 Z
11
+ date: 2019-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -402,6 +402,7 @@ files:
402
402
  - lib/elasticsearch/api/actions/index.rb
403
403
  - lib/elasticsearch/api/actions/indices/analyze.rb
404
404
  - lib/elasticsearch/api/actions/indices/clear_cache.rb
405
+ - lib/elasticsearch/api/actions/indices/clone.rb
405
406
  - lib/elasticsearch/api/actions/indices/close.rb
406
407
  - lib/elasticsearch/api/actions/indices/create.rb
407
408
  - lib/elasticsearch/api/actions/indices/delete.rb
@@ -547,6 +548,7 @@ files:
547
548
  - spec/elasticsearch/api/actions/index_document_spec.rb
548
549
  - spec/elasticsearch/api/actions/indices/analyze_spec.rb
549
550
  - spec/elasticsearch/api/actions/indices/clear_cache_spec.rb
551
+ - spec/elasticsearch/api/actions/indices/clone_spec.rb
550
552
  - spec/elasticsearch/api/actions/indices/close_spec.rb
551
553
  - spec/elasticsearch/api/actions/indices/create_spec.rb
552
554
  - spec/elasticsearch/api/actions/indices/delete_alias_spec.rb
@@ -657,7 +659,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
657
659
  - !ruby/object:Gem::Version
658
660
  version: '0'
659
661
  requirements: []
660
- rubygems_version: 3.0.3
662
+ rubygems_version: 3.0.6
661
663
  signing_key:
662
664
  specification_version: 4
663
665
  summary: Ruby API for Elasticsearch.
@@ -710,6 +712,7 @@ test_files:
710
712
  - spec/elasticsearch/api/actions/index_document_spec.rb
711
713
  - spec/elasticsearch/api/actions/indices/analyze_spec.rb
712
714
  - spec/elasticsearch/api/actions/indices/clear_cache_spec.rb
715
+ - spec/elasticsearch/api/actions/indices/clone_spec.rb
713
716
  - spec/elasticsearch/api/actions/indices/close_spec.rb
714
717
  - spec/elasticsearch/api/actions/indices/create_spec.rb
715
718
  - spec/elasticsearch/api/actions/indices/delete_alias_spec.rb