opensearch-api 2.0.2 → 2.2.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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +28 -0
  5. data/Gemfile +2 -2
  6. data/README.md +12 -182
  7. data/Rakefile +5 -5
  8. data/USER_GUIDE.md +155 -0
  9. data/lib/opensearch/api/actions/cat/all_pit_segments.rb +46 -0
  10. data/lib/opensearch/api/actions/cat/allocation.rb +4 -2
  11. data/lib/opensearch/api/actions/cat/cluster_manager.rb +54 -0
  12. data/lib/opensearch/api/actions/cat/indices.rb +4 -2
  13. data/lib/opensearch/api/actions/cat/master.rb +3 -1
  14. data/lib/opensearch/api/actions/cat/nodeattrs.rb +4 -2
  15. data/lib/opensearch/api/actions/cat/nodes.rb +4 -2
  16. data/lib/opensearch/api/actions/cat/pending_tasks.rb +4 -2
  17. data/lib/opensearch/api/actions/cat/pit_segments.rb +49 -0
  18. data/lib/opensearch/api/actions/cat/plugins.rb +4 -2
  19. data/lib/opensearch/api/actions/cat/repositories.rb +4 -2
  20. data/lib/opensearch/api/actions/cat/shards.rb +4 -2
  21. data/lib/opensearch/api/actions/cat/snapshots.rb +3 -1
  22. data/lib/opensearch/api/actions/cat/templates.rb +4 -2
  23. data/lib/opensearch/api/actions/cat/thread_pool.rb +4 -2
  24. data/lib/opensearch/api/actions/cluster/delete_component_template.rb +4 -2
  25. data/lib/opensearch/api/actions/cluster/exists_component_template.rb +4 -2
  26. data/lib/opensearch/api/actions/cluster/get_component_template.rb +4 -2
  27. data/lib/opensearch/api/actions/cluster/get_settings.rb +3 -1
  28. data/lib/opensearch/api/actions/cluster/health.rb +4 -2
  29. data/lib/opensearch/api/actions/cluster/pending_tasks.rb +5 -3
  30. data/lib/opensearch/api/actions/cluster/put_component_template.rb +4 -2
  31. data/lib/opensearch/api/actions/cluster/put_settings.rb +3 -1
  32. data/lib/opensearch/api/actions/cluster/reroute.rb +4 -2
  33. data/lib/opensearch/api/actions/cluster/state.rb +4 -2
  34. data/lib/opensearch/api/actions/create_pit.rb +45 -0
  35. data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +4 -2
  36. data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +4 -2
  37. data/lib/opensearch/api/actions/delete_all_pits.rb +26 -0
  38. data/lib/opensearch/api/actions/delete_pit.rb +30 -0
  39. data/lib/opensearch/api/actions/delete_script.rb +4 -2
  40. data/lib/opensearch/api/actions/features/get_features.rb +4 -2
  41. data/lib/opensearch/api/actions/get_all_pits.rb +26 -0
  42. data/lib/opensearch/api/actions/get_script.rb +4 -2
  43. data/lib/opensearch/api/actions/indices/add_block.rb +3 -1
  44. data/lib/opensearch/api/actions/indices/clone.rb +3 -1
  45. data/lib/opensearch/api/actions/indices/close.rb +3 -1
  46. data/lib/opensearch/api/actions/indices/create.rb +4 -2
  47. data/lib/opensearch/api/actions/indices/delete.rb +3 -1
  48. data/lib/opensearch/api/actions/indices/delete_alias.rb +4 -2
  49. data/lib/opensearch/api/actions/indices/delete_index_template.rb +4 -2
  50. data/lib/opensearch/api/actions/indices/delete_template.rb +4 -2
  51. data/lib/opensearch/api/actions/indices/exists_index_template.rb +4 -2
  52. data/lib/opensearch/api/actions/indices/exists_template.rb +4 -2
  53. data/lib/opensearch/api/actions/indices/get.rb +4 -2
  54. data/lib/opensearch/api/actions/indices/get_index_template.rb +4 -2
  55. data/lib/opensearch/api/actions/indices/get_mapping.rb +4 -2
  56. data/lib/opensearch/api/actions/indices/get_settings.rb +3 -1
  57. data/lib/opensearch/api/actions/indices/get_template.rb +4 -2
  58. data/lib/opensearch/api/actions/indices/open.rb +3 -1
  59. data/lib/opensearch/api/actions/indices/put_alias.rb +4 -2
  60. data/lib/opensearch/api/actions/indices/put_index_template.rb +4 -2
  61. data/lib/opensearch/api/actions/indices/put_mapping.rb +3 -1
  62. data/lib/opensearch/api/actions/indices/put_settings.rb +3 -1
  63. data/lib/opensearch/api/actions/indices/put_template.rb +4 -2
  64. data/lib/opensearch/api/actions/indices/rollover.rb +3 -1
  65. data/lib/opensearch/api/actions/indices/shrink.rb +3 -1
  66. data/lib/opensearch/api/actions/indices/simulate_index_template.rb +4 -2
  67. data/lib/opensearch/api/actions/indices/simulate_template.rb +4 -2
  68. data/lib/opensearch/api/actions/indices/split.rb +3 -1
  69. data/lib/opensearch/api/actions/indices/update_aliases.rb +4 -2
  70. data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +3 -1
  71. data/lib/opensearch/api/actions/ingest/get_pipeline.rb +4 -2
  72. data/lib/opensearch/api/actions/ingest/put_pipeline.rb +3 -1
  73. data/lib/opensearch/api/actions/put_script.rb +3 -1
  74. data/lib/opensearch/api/actions/search_shards.rb +1 -1
  75. data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +3 -1
  76. data/lib/opensearch/api/actions/snapshot/clone.rb +4 -2
  77. data/lib/opensearch/api/actions/snapshot/create.rb +3 -1
  78. data/lib/opensearch/api/actions/snapshot/create_repository.rb +3 -1
  79. data/lib/opensearch/api/actions/snapshot/delete.rb +4 -2
  80. data/lib/opensearch/api/actions/snapshot/delete_repository.rb +3 -1
  81. data/lib/opensearch/api/actions/snapshot/get.rb +3 -1
  82. data/lib/opensearch/api/actions/snapshot/get_features.rb +4 -2
  83. data/lib/opensearch/api/actions/snapshot/get_repository.rb +3 -2
  84. data/lib/opensearch/api/actions/snapshot/restore.rb +3 -1
  85. data/lib/opensearch/api/actions/snapshot/status.rb +3 -1
  86. data/lib/opensearch/api/actions/snapshot/verify_repository.rb +3 -1
  87. data/lib/opensearch/api/utils.rb +4 -4
  88. data/lib/opensearch/api/version.rb +1 -1
  89. data/opensearch-api.gemspec +2 -2
  90. data/spec/opensearch/api/actions/cat/all_pit_segments_spec.rb +36 -0
  91. data/spec/opensearch/api/actions/cat/allocation_spec.rb +6 -7
  92. data/spec/opensearch/api/actions/cat/cluster_manager_spec.rb +26 -0
  93. data/spec/opensearch/api/actions/cat/pit_segments_spec.rb +43 -0
  94. data/spec/opensearch/api/actions/create_pit_spec.rb +58 -0
  95. data/spec/opensearch/api/actions/delete_all_pits_spec.rb +35 -0
  96. data/spec/opensearch/api/actions/delete_pit_spec.rb +41 -0
  97. data/spec/opensearch/api/actions/get_all_pits_spec.rb +35 -0
  98. data/spec/opensearch/api/actions/get_script_spec.rb +2 -2
  99. data/spec/opensearch/api/actions/hashie_spec.rb +0 -2
  100. data/spec/opensearch/api/actions/indices/clone_spec.rb +2 -2
  101. data/spec/opensearch/api/utils_spec.rb +6 -6
  102. data.tar.gz.sig +1 -1
  103. metadata +40 -23
  104. metadata.gz.sig +0 -0
  105. data/lib/opensearch/api/actions/close_point_in_time.rb +0 -50
  106. data/lib/opensearch/api/actions/open_point_in_time.rb +0 -72
  107. data/spec/opensearch/api/actions/close_point_in_time_spec.rb +0 -43
  108. data/spec/opensearch/api/actions/open_point_in_time_spec.rb +0 -53
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Removes stale data from repository.
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
@@ -58,6 +59,7 @@ module OpenSearch
58
59
  # @since 6.2.0
59
60
  ParamsRegistry.register(:cleanup_repository, [
60
61
  :master_timeout,
62
+ :cluster_manager_timeout,
61
63
  :timeout
62
64
  ].freeze)
63
65
  end
@@ -33,7 +33,8 @@ module OpenSearch
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot The name of the snapshot to clone from
35
35
  # @option arguments [String] :target_snapshot The name of the cloned snapshot to create
36
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
37
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  # @option arguments [Hash] :body The snapshot clone definition (*Required*)
39
40
  #
@@ -66,7 +67,8 @@ module OpenSearch
66
67
  #
67
68
  # @since 6.2.0
68
69
  ParamsRegistry.register(:clone, [
69
- :master_timeout
70
+ :master_timeout,
71
+ :cluster_manager_timeout
70
72
  ].freeze)
71
73
  end
72
74
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot A snapshot name
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  # @option arguments [Hash] :body The snapshot definition
@@ -63,6 +64,7 @@ module OpenSearch
63
64
  # @since 6.2.0
64
65
  ParamsRegistry.register(:create, [
65
66
  :master_timeout,
67
+ :cluster_manager_timeout,
66
68
  :wait_for_completion
67
69
  ].freeze)
68
70
  end
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Creates a repository.
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Boolean] :verify Whether to verify the repository after creation
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
@@ -61,6 +62,7 @@ module OpenSearch
61
62
  # @since 6.2.0
62
63
  ParamsRegistry.register(:create_repository, [
63
64
  :master_timeout,
65
+ :cluster_manager_timeout,
64
66
  :timeout,
65
67
  :verify
66
68
  ].freeze)
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot A snapshot name
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
38
39
  #
@@ -64,7 +65,8 @@ module OpenSearch
64
65
  #
65
66
  # @since 6.2.0
66
67
  ParamsRegistry.register(:delete, [
67
- :master_timeout
68
+ :master_timeout,
69
+ :cluster_manager_timeout
68
70
  ].freeze)
69
71
  end
70
72
  end
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Deletes a repository.
32
32
  #
33
33
  # @option arguments [List] :repository Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported.
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
@@ -62,6 +63,7 @@ module OpenSearch
62
63
  # @since 6.2.0
63
64
  ParamsRegistry.register(:delete_repository, [
64
65
  :master_timeout,
66
+ :cluster_manager_timeout,
65
67
  :timeout
66
68
  ].freeze)
67
69
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [List] :snapshot A comma-separated list of snapshot names
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
37
38
  # @option arguments [Boolean] :index_details Whether to include details of each index in the snapshot, if those details are available. Defaults to false.
38
39
  # @option arguments [Boolean] :include_repository Whether to include the repository name in the snapshot info. Defaults to true.
@@ -69,6 +70,7 @@ module OpenSearch
69
70
  # @since 6.2.0
70
71
  ParamsRegistry.register(:get, [
71
72
  :master_timeout,
73
+ :cluster_manager_timeout,
72
74
  :ignore_unavailable,
73
75
  :index_details,
74
76
  :include_repository,
@@ -30,7 +30,8 @@ module OpenSearch
30
30
  module Actions
31
31
  # Returns a list of features which can be snapshotted in this cluster.
32
32
  #
33
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
33
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
34
35
  # @option arguments [Hash] :headers Custom HTTP headers
35
36
  #
36
37
  #
@@ -51,7 +52,8 @@ module OpenSearch
51
52
  #
52
53
  # @since 6.2.0
53
54
  ParamsRegistry.register(:get_features, [
54
- :master_timeout
55
+ :master_timeout,
56
+ :cluster_manager_timeout
55
57
  ].freeze)
56
58
  end
57
59
  end
@@ -31,8 +31,8 @@ module OpenSearch
31
31
  # Returns information about a repository.
32
32
  #
33
33
  # @option arguments [List] :repository A comma-separated list of repository names
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to cluster_manager node
35
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from cluster_manager node (default: false)
36
36
  # @option arguments [Hash] :headers Custom HTTP headers
37
37
  #
38
38
  #
@@ -64,6 +64,7 @@ module OpenSearch
64
64
  # @since 6.2.0
65
65
  ParamsRegistry.register(:get_repository, [
66
66
  :master_timeout,
67
+ :cluster_manager_timeout,
67
68
  :local
68
69
  ].freeze)
69
70
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [String] :snapshot A snapshot name
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  # @option arguments [Hash] :body Details of what to restore
@@ -63,6 +64,7 @@ module OpenSearch
63
64
  # @since 6.2.0
64
65
  ParamsRegistry.register(:restore, [
65
66
  :master_timeout,
67
+ :cluster_manager_timeout,
66
68
  :wait_for_completion
67
69
  ].freeze)
68
70
  end
@@ -32,7 +32,8 @@ module OpenSearch
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
34
  # @option arguments [List] :snapshot A comma-separated list of snapshot names
35
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
36
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
36
37
  # @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
37
38
  # @option arguments [Hash] :headers Custom HTTP headers
38
39
  #
@@ -69,6 +70,7 @@ module OpenSearch
69
70
  # @since 6.2.0
70
71
  ParamsRegistry.register(:status, [
71
72
  :master_timeout,
73
+ :cluster_manager_timeout,
72
74
  :ignore_unavailable
73
75
  ].freeze)
74
76
  end
@@ -31,7 +31,8 @@ module OpenSearch
31
31
  # Verifies a repository.
32
32
  #
33
33
  # @option arguments [String] :repository A repository name
34
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
34
+ # @option arguments [Time] :master_timeout (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node
35
+ # @option arguments [Time] :cluster_manager_timeout Explicit operation timeout for connection to cluster_manager node
35
36
  # @option arguments [Time] :timeout Explicit operation timeout
36
37
  # @option arguments [Hash] :headers Custom HTTP headers
37
38
  #
@@ -58,6 +59,7 @@ module OpenSearch
58
59
  # @since 6.2.0
59
60
  ParamsRegistry.register(:verify_repository, [
60
61
  :master_timeout,
62
+ :cluster_manager_timeout,
61
63
  :timeout
62
64
  ].freeze)
63
65
  end
@@ -97,13 +97,13 @@ module OpenSearch
97
97
  # in a single item.
98
98
  #
99
99
  # OpenSearch::API::Utils.__bulkify [
100
- # { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
101
- # { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
100
+ # { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
101
+ # { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
102
102
  # ]
103
103
  #
104
- # # => {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
104
+ # # => {"index":{"_index":"myindexA","_id":"1"}}
105
105
  # # => {"title":"Test"}
106
- # # => {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
106
+ # # => {"update":{"_index":"myindexB","_id":"2"}}
107
107
  # # => {"doc":{"title":"Update"}}
108
108
  #
109
109
  def __bulkify(payload)
@@ -26,6 +26,6 @@
26
26
 
27
27
  module OpenSearch
28
28
  module API
29
- VERSION = '2.0.2'.freeze
29
+ VERSION = '2.2.0'.freeze
30
30
  end
31
31
  end
@@ -64,7 +64,7 @@ Gem::Specification.new do |s|
64
64
 
65
65
  s.add_development_dependency 'ansi'
66
66
  s.add_development_dependency 'bundler'
67
- s.add_development_dependency 'opensearch'
67
+ s.add_development_dependency 'opensearch-ruby', '~> 2'
68
68
  s.add_development_dependency 'opensearch-transport'
69
69
  s.add_development_dependency 'minitest'
70
70
  s.add_development_dependency 'minitest-reporters'
@@ -86,6 +86,6 @@ Gem::Specification.new do |s|
86
86
  s.add_development_dependency 'ruby-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
87
87
 
88
88
  s.description = <<-DESC.gsub(/^ /, '')
89
- Ruby API for OpenSearch. See the `opensearch` gem for full integration.
89
+ Ruby API for OpenSearch. See the `opensearch-ruby` gem for full integration.
90
90
  DESC
91
91
  end
@@ -0,0 +1,36 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client.cat#all_pit_segments' do
13
+
14
+ let(:expected_args) do
15
+ [
16
+ 'GET',
17
+ '_cat/pit_segments/_all',
18
+ {},
19
+ nil,
20
+ {}
21
+ ]
22
+ end
23
+ let(:client) do
24
+ Class.new { include OpenSearch::API }.new
25
+ end
26
+
27
+ it 'does not accept unregistered params' do
28
+ expect {
29
+ client.cat.all_pit_segments(something: :else)
30
+ }.to raise_exception(ArgumentError)
31
+ end
32
+
33
+ it 'performs the request' do
34
+ expect(client_double.cat.all_pit_segments).to eq({})
35
+ end
36
+ end
@@ -27,18 +27,17 @@
27
27
  require 'spec_helper'
28
28
 
29
29
  describe 'client.cat#allocation' do
30
-
31
30
  let(:expected_args) do
32
31
  [
33
- 'GET',
34
- '_cat/allocation',
35
- {},
36
- nil,
37
- {}
32
+ 'GET',
33
+ '_cat/allocation',
34
+ {cluster_manager_timeout: 2},
35
+ nil,
36
+ {}
38
37
  ]
39
38
  end
40
39
 
41
40
  it 'performs the request' do
42
- expect(client_double.cat.allocation).to eq({})
41
+ expect(client_double.cat.allocation(cluster_manager_timeout: 2)).to eq({})
43
42
  end
44
43
  end
@@ -0,0 +1,26 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client.cat#cluster_manager' do
13
+ let(:expected_args) do
14
+ [
15
+ 'GET',
16
+ '_cat/cluster_manager',
17
+ {},
18
+ nil,
19
+ {}
20
+ ]
21
+ end
22
+
23
+ it 'performs the request' do
24
+ expect(client_double.cat.cluster_manager).to eq({})
25
+ end
26
+ end
@@ -0,0 +1,43 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client.cat#pit_segments' do
13
+
14
+ let(:expected_args) do
15
+ [
16
+ 'GET',
17
+ '_cat/pit_segments',
18
+ {},
19
+ { pit_id: ['abc'] },
20
+ {}
21
+ ]
22
+ end
23
+
24
+ let(:client) do
25
+ Class.new { include OpenSearch::API }.new
26
+ end
27
+
28
+ it 'requires the :body argument' do
29
+ expect {
30
+ client.cat.pit_segments
31
+ }.to raise_exception(ArgumentError)
32
+ end
33
+
34
+ it 'does not accept unregistered params' do
35
+ expect {
36
+ client.cat.pit_segments(body: {}, something: :else)
37
+ }.to raise_exception(ArgumentError)
38
+ end
39
+
40
+ it 'performs the request' do
41
+ expect(client_double.cat.pit_segments(body: { pit_id: ['abc'] })).to eq({})
42
+ end
43
+ end
@@ -0,0 +1,58 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client#create_pit' do
13
+ let(:expected_args) do
14
+ [
15
+ 'POST',
16
+ 'movies,books/_search/point_in_time',
17
+ { keep_alive: '1m',
18
+ preference: :random,
19
+ routing: :route,
20
+ expand_wildcards: :open,
21
+ allow_partial_pit_creation: false },
22
+ nil
23
+ ]
24
+ end
25
+
26
+ let(:client) do
27
+ Class.new { include OpenSearch::API }.new
28
+ end
29
+
30
+ it 'requires the :index argument' do
31
+ expect {
32
+ client.create_pit(keep_alive: '1m')
33
+ }.to raise_exception(ArgumentError)
34
+ end
35
+
36
+ it 'requires the :index argument' do
37
+ expect {
38
+ client.create_pit(index: 'movies')
39
+ }.to raise_exception(ArgumentError)
40
+ end
41
+
42
+ it 'does not accept unregistered params' do
43
+ expect {
44
+ client.create_pit(index: 'movies', keep_alive: '1m', something: 42)
45
+ }.to raise_exception(ArgumentError)
46
+ end
47
+
48
+ it 'performs the request with all optional params' do
49
+ expect(client_double.create_pit(
50
+ index: %w[movies books],
51
+ keep_alive: '1m',
52
+ preference: :random,
53
+ routing: :route,
54
+ expand_wildcards: :open,
55
+ allow_partial_pit_creation: false
56
+ )).to eq({})
57
+ end
58
+ end
@@ -0,0 +1,35 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client#delete_all_pits' do
13
+ let(:expected_args) do
14
+ [
15
+ 'DELETE',
16
+ '_search/point_in_time/_all',
17
+ {},
18
+ nil
19
+ ]
20
+ end
21
+
22
+ let(:client) do
23
+ Class.new { include OpenSearch::API }.new
24
+ end
25
+
26
+ it 'does not accept unregistered params' do
27
+ expect {
28
+ client.delete_all_pits(something: :else)
29
+ }.to raise_exception(ArgumentError)
30
+ end
31
+
32
+ it 'performs the request with all optional params' do
33
+ expect(client_double.delete_all_pits).to eq({})
34
+ end
35
+ end
@@ -0,0 +1,41 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client#delete_pit' do
13
+ let(:expected_args) do
14
+ [
15
+ 'DELETE',
16
+ '_search/point_in_time',
17
+ {},
18
+ { pit_id: ['abc'] }
19
+ ]
20
+ end
21
+
22
+ let(:client) do
23
+ Class.new { include OpenSearch::API }.new
24
+ end
25
+
26
+ it 'requires the :body argument' do
27
+ expect {
28
+ client.delete_pit
29
+ }.to raise_exception(ArgumentError)
30
+ end
31
+
32
+ it 'does not accept unregistered params' do
33
+ expect {
34
+ client.delete_pit(body: {}, something: :else)
35
+ }.to raise_exception(ArgumentError)
36
+ end
37
+
38
+ it 'performs the request with all optional params' do
39
+ expect(client_double.delete_pit(body: { pit_id: ['abc'] })).to eq({})
40
+ end
41
+ end
@@ -0,0 +1,35 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+
10
+ require 'spec_helper'
11
+
12
+ describe 'client#get_all_pits' do
13
+ let(:expected_args) do
14
+ [
15
+ 'GET',
16
+ '_search/point_in_time/_all',
17
+ {},
18
+ nil
19
+ ]
20
+ end
21
+
22
+ let(:client) do
23
+ Class.new { include OpenSearch::API }.new
24
+ end
25
+
26
+ it 'does not accept unregistered params' do
27
+ expect {
28
+ client.get_all_pits(something: :else)
29
+ }.to raise_exception(ArgumentError)
30
+ end
31
+
32
+ it 'performs the request with all optional params' do
33
+ expect(client_double.get_all_pits).to eq({})
34
+ end
35
+ end
@@ -49,11 +49,11 @@ describe 'client#get_script' do
49
49
  context 'when the `lang` parameter is specificed' do
50
50
 
51
51
  let(:params) do
52
- { master_timeout: '1s' }
52
+ { cluster_manager_timeout: '1s' }
53
53
  end
54
54
 
55
55
  it 'performs the request' do
56
- expect(client_double.get_script(master_timeout: '1s', id: 'foo')).to eq({})
56
+ expect(client_double.get_script(cluster_manager_timeout: '1s', id: 'foo')).to eq({})
57
57
  end
58
58
  end
59
59
  end
@@ -45,7 +45,6 @@ describe 'Hashie' do
45
45
  "hits": [
46
46
  {
47
47
  "_index": "myindex",
48
- "_type": "mytype",
49
48
  "_id": "1",
50
49
  "_score": 0.51104903,
51
50
  "_source": {
@@ -63,7 +62,6 @@ describe 'Hashie' do
63
62
  },
64
63
  "facets": {
65
64
  "tags": {
66
- "_type": "terms",
67
65
  "missing": 0,
68
66
  "total": 10,
69
67
  "other": 0,
@@ -88,7 +88,7 @@ describe 'client.indices#clone' do
88
88
  let(:params) do
89
89
  {
90
90
  timeout: '1s',
91
- master_timeout: '10s',
91
+ cluster_manager_timeout: '10s',
92
92
  wait_for_active_shards: 1
93
93
  }
94
94
  end
@@ -97,7 +97,7 @@ describe 'client.indices#clone' do
97
97
  expect(client_double.indices.clone(index: 'my_source_index',
98
98
  target: 'my_target_index',
99
99
  timeout: '1s',
100
- master_timeout: '10s',
100
+ cluster_manager_timeout: '10s',
101
101
  wait_for_active_shards: 1)).to eq({})
102
102
  end
103
103
  end
@@ -109,19 +109,19 @@ describe OpenSearch::API::Utils do
109
109
 
110
110
  let(:result) do
111
111
  utils.__bulkify [
112
- { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
113
- { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
114
- { :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } }
112
+ { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
113
+ { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
114
+ { :delete => { :_index => 'myindexC', :_id => '3' } }
115
115
  ]
116
116
  end
117
117
 
118
118
  let(:expected_string) do
119
119
  <<-PAYLOAD.gsub(/^\s+/, '')
120
- {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
120
+ {"index":{"_index":"myindexA","_id":"1"}}
121
121
  {"title":"Test"}
122
- {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
122
+ {"update":{"_index":"myindexB","_id":"2"}}
123
123
  {"doc":{"title":"Update"}}
124
- {"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
124
+ {"delete":{"_index":"myindexC","_id":"3"}}
125
125
  PAYLOAD
126
126
  end
127
127