opensearch-api 2.1.0 → 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.
@@ -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
@@ -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
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayesh Hathila
@@ -33,7 +33,7 @@ cert_chain:
33
33
  r+j7FLyKuk5DzIxiCp8QN5dU71BbGUmsHf/C5UV76WLPOFX/szeaHhPwpjR3sK7r
34
34
  5zLgCV1KP7cgDdCYMlmZGeSViU8NV+Yy8/ghrzGpqVw=
35
35
  -----END CERTIFICATE-----
36
- date: 2022-11-30 00:00:00.000000000 Z
36
+ date: 2023-03-29 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: multi_json
@@ -78,19 +78,19 @@ dependencies:
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  - !ruby/object:Gem::Dependency
81
- name: opensearch
81
+ name: opensearch-ruby
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
84
+ - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '0'
86
+ version: '2'
87
87
  type: :development
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
91
+ - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '2'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: opensearch-transport
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -315,7 +315,7 @@ dependencies:
315
315
  - - ">="
316
316
  - !ruby/object:Gem::Version
317
317
  version: '0'
318
- description: 'Ruby API for OpenSearch. See the `opensearch` gem for full integration.
318
+ description: 'Ruby API for OpenSearch. See the `opensearch-ruby` gem for full integration.
319
319
 
320
320
  '
321
321
  email:
@@ -330,16 +330,19 @@ extra_rdoc_files:
330
330
  - LICENSE
331
331
  files:
332
332
  - ".gitignore"
333
+ - CHANGELOG.md
333
334
  - Gemfile
334
335
  - LICENSE
335
336
  - README.md
336
337
  - Rakefile
338
+ - USER_GUIDE.md
337
339
  - lib/opensearch-api.rb
338
340
  - lib/opensearch/api.rb
339
341
  - lib/opensearch/api/actions/abort_benchmark.rb
340
342
  - lib/opensearch/api/actions/benchmark.rb
341
343
  - lib/opensearch/api/actions/bulk.rb
342
344
  - lib/opensearch/api/actions/cat/aliases.rb
345
+ - lib/opensearch/api/actions/cat/all_pit_segments.rb
343
346
  - lib/opensearch/api/actions/cat/allocation.rb
344
347
  - lib/opensearch/api/actions/cat/cluster_manager.rb
345
348
  - lib/opensearch/api/actions/cat/count.rb
@@ -352,6 +355,7 @@ files:
352
355
  - lib/opensearch/api/actions/cat/nodes.rb
353
356
  - lib/opensearch/api/actions/cat/params_registry.rb
354
357
  - lib/opensearch/api/actions/cat/pending_tasks.rb
358
+ - lib/opensearch/api/actions/cat/pit_segments.rb
355
359
  - lib/opensearch/api/actions/cat/plugins.rb
356
360
  - lib/opensearch/api/actions/cat/recovery.rb
357
361
  - lib/opensearch/api/actions/cat/repositories.rb
@@ -362,7 +366,6 @@ files:
362
366
  - lib/opensearch/api/actions/cat/templates.rb
363
367
  - lib/opensearch/api/actions/cat/thread_pool.rb
364
368
  - lib/opensearch/api/actions/clear_scroll.rb
365
- - lib/opensearch/api/actions/close_point_in_time.rb
366
369
  - lib/opensearch/api/actions/cluster/allocation_explain.rb
367
370
  - lib/opensearch/api/actions/cluster/delete_component_template.rb
368
371
  - lib/opensearch/api/actions/cluster/delete_voting_config_exclusions.rb
@@ -381,14 +384,17 @@ files:
381
384
  - lib/opensearch/api/actions/cluster/stats.rb
382
385
  - lib/opensearch/api/actions/count.rb
383
386
  - lib/opensearch/api/actions/create.rb
387
+ - lib/opensearch/api/actions/create_pit.rb
384
388
  - lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb
385
389
  - lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb
386
390
  - lib/opensearch/api/actions/dangling_indices/list_dangling_indices.rb
387
391
  - lib/opensearch/api/actions/dangling_indices/params_registry.rb
388
392
  - lib/opensearch/api/actions/delete.rb
393
+ - lib/opensearch/api/actions/delete_all_pits.rb
389
394
  - lib/opensearch/api/actions/delete_by_query.rb
390
395
  - lib/opensearch/api/actions/delete_by_query_rethrottle.rb
391
396
  - lib/opensearch/api/actions/delete_by_rethrottle.rb
397
+ - lib/opensearch/api/actions/delete_pit.rb
392
398
  - lib/opensearch/api/actions/delete_script.rb
393
399
  - lib/opensearch/api/actions/exists.rb
394
400
  - lib/opensearch/api/actions/exists_source.rb
@@ -398,6 +404,7 @@ files:
398
404
  - lib/opensearch/api/actions/features/reset_features.rb
399
405
  - lib/opensearch/api/actions/field_caps.rb
400
406
  - lib/opensearch/api/actions/get.rb
407
+ - lib/opensearch/api/actions/get_all_pits.rb
401
408
  - lib/opensearch/api/actions/get_script.rb
402
409
  - lib/opensearch/api/actions/get_script_context.rb
403
410
  - lib/opensearch/api/actions/get_script_languages.rb
@@ -469,7 +476,6 @@ files:
469
476
  - lib/opensearch/api/actions/nodes/shutdown.rb
470
477
  - lib/opensearch/api/actions/nodes/stats.rb
471
478
  - lib/opensearch/api/actions/nodes/usage.rb
472
- - lib/opensearch/api/actions/open_point_in_time.rb
473
479
  - lib/opensearch/api/actions/params_registry.rb
474
480
  - lib/opensearch/api/actions/ping.rb
475
481
  - lib/opensearch/api/actions/put_script.rb
@@ -529,6 +535,7 @@ files:
529
535
  - spec/opensearch/api/actions/benchmark_spec.rb
530
536
  - spec/opensearch/api/actions/bulk_spec.rb
531
537
  - spec/opensearch/api/actions/cat/aliases_spec.rb
538
+ - spec/opensearch/api/actions/cat/all_pit_segments_spec.rb
532
539
  - spec/opensearch/api/actions/cat/allocation_spec.rb
533
540
  - spec/opensearch/api/actions/cat/cluster_manager_spec.rb
534
541
  - spec/opensearch/api/actions/cat/count_spec.rb
@@ -540,6 +547,7 @@ files:
540
547
  - spec/opensearch/api/actions/cat/nodeattrs_spec.rb
541
548
  - spec/opensearch/api/actions/cat/nodes_spec.rb
542
549
  - spec/opensearch/api/actions/cat/pending_tasks_spec.rb
550
+ - spec/opensearch/api/actions/cat/pit_segments_spec.rb
543
551
  - spec/opensearch/api/actions/cat/plugins_spec.rb
544
552
  - spec/opensearch/api/actions/cat/recovery_spec.rb
545
553
  - spec/opensearch/api/actions/cat/repositories_spec.rb
@@ -550,7 +558,6 @@ files:
550
558
  - spec/opensearch/api/actions/cat/templates_spec.rb
551
559
  - spec/opensearch/api/actions/cat/thread_pool_spec.rb
552
560
  - spec/opensearch/api/actions/clear_scroll_spec.rb
553
- - spec/opensearch/api/actions/close_point_in_time_spec.rb
554
561
  - spec/opensearch/api/actions/cluster/allocation_explain_spec.rb
555
562
  - spec/opensearch/api/actions/cluster/get_settings_spec.rb
556
563
  - spec/opensearch/api/actions/cluster/health_spec.rb
@@ -562,17 +569,21 @@ files:
562
569
  - spec/opensearch/api/actions/cluster/stats_spec.rb
563
570
  - spec/opensearch/api/actions/count_spec.rb
564
571
  - spec/opensearch/api/actions/create_document_spec.rb
572
+ - spec/opensearch/api/actions/create_pit_spec.rb
565
573
  - spec/opensearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb
566
574
  - spec/opensearch/api/actions/dangling_indices/import_dangling_indices_spec.rb
567
575
  - spec/opensearch/api/actions/dangling_indices/list_dangling_indices_spec.rb
576
+ - spec/opensearch/api/actions/delete_all_pits_spec.rb
568
577
  - spec/opensearch/api/actions/delete_by_query_spec.rb
569
578
  - spec/opensearch/api/actions/delete_document_spec.rb
579
+ - spec/opensearch/api/actions/delete_pit_spec.rb
570
580
  - spec/opensearch/api/actions/delete_script_spec.rb
571
581
  - spec/opensearch/api/actions/exists_document_spec.rb
572
582
  - spec/opensearch/api/actions/explain_document_spec.rb
573
583
  - spec/opensearch/api/actions/features/get_features_spec.rb
574
584
  - spec/opensearch/api/actions/features/reset_features_spec.rb
575
585
  - spec/opensearch/api/actions/field_caps_spec.rb
586
+ - spec/opensearch/api/actions/get_all_pits_spec.rb
576
587
  - spec/opensearch/api/actions/get_document_source_spec.rb
577
588
  - spec/opensearch/api/actions/get_document_spec.rb
578
589
  - spec/opensearch/api/actions/get_script_spec.rb
@@ -631,7 +642,6 @@ files:
631
642
  - spec/opensearch/api/actions/nodes/reload_secure_settings_spec.rb
632
643
  - spec/opensearch/api/actions/nodes/shutdown_spec.rb
633
644
  - spec/opensearch/api/actions/nodes/stats_spec.rb
634
- - spec/opensearch/api/actions/open_point_in_time_spec.rb
635
645
  - spec/opensearch/api/actions/ping_spec.rb
636
646
  - spec/opensearch/api/actions/put_script_spec.rb
637
647
  - spec/opensearch/api/actions/reindex_spec.rb
@@ -701,6 +711,7 @@ test_files:
701
711
  - spec/opensearch/api/actions/benchmark_spec.rb
702
712
  - spec/opensearch/api/actions/bulk_spec.rb
703
713
  - spec/opensearch/api/actions/cat/aliases_spec.rb
714
+ - spec/opensearch/api/actions/cat/all_pit_segments_spec.rb
704
715
  - spec/opensearch/api/actions/cat/allocation_spec.rb
705
716
  - spec/opensearch/api/actions/cat/cluster_manager_spec.rb
706
717
  - spec/opensearch/api/actions/cat/count_spec.rb
@@ -712,6 +723,7 @@ test_files:
712
723
  - spec/opensearch/api/actions/cat/nodeattrs_spec.rb
713
724
  - spec/opensearch/api/actions/cat/nodes_spec.rb
714
725
  - spec/opensearch/api/actions/cat/pending_tasks_spec.rb
726
+ - spec/opensearch/api/actions/cat/pit_segments_spec.rb
715
727
  - spec/opensearch/api/actions/cat/plugins_spec.rb
716
728
  - spec/opensearch/api/actions/cat/recovery_spec.rb
717
729
  - spec/opensearch/api/actions/cat/repositories_spec.rb
@@ -722,7 +734,6 @@ test_files:
722
734
  - spec/opensearch/api/actions/cat/templates_spec.rb
723
735
  - spec/opensearch/api/actions/cat/thread_pool_spec.rb
724
736
  - spec/opensearch/api/actions/clear_scroll_spec.rb
725
- - spec/opensearch/api/actions/close_point_in_time_spec.rb
726
737
  - spec/opensearch/api/actions/cluster/allocation_explain_spec.rb
727
738
  - spec/opensearch/api/actions/cluster/get_settings_spec.rb
728
739
  - spec/opensearch/api/actions/cluster/health_spec.rb
@@ -734,17 +745,21 @@ test_files:
734
745
  - spec/opensearch/api/actions/cluster/stats_spec.rb
735
746
  - spec/opensearch/api/actions/count_spec.rb
736
747
  - spec/opensearch/api/actions/create_document_spec.rb
748
+ - spec/opensearch/api/actions/create_pit_spec.rb
737
749
  - spec/opensearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb
738
750
  - spec/opensearch/api/actions/dangling_indices/import_dangling_indices_spec.rb
739
751
  - spec/opensearch/api/actions/dangling_indices/list_dangling_indices_spec.rb
752
+ - spec/opensearch/api/actions/delete_all_pits_spec.rb
740
753
  - spec/opensearch/api/actions/delete_by_query_spec.rb
741
754
  - spec/opensearch/api/actions/delete_document_spec.rb
755
+ - spec/opensearch/api/actions/delete_pit_spec.rb
742
756
  - spec/opensearch/api/actions/delete_script_spec.rb
743
757
  - spec/opensearch/api/actions/exists_document_spec.rb
744
758
  - spec/opensearch/api/actions/explain_document_spec.rb
745
759
  - spec/opensearch/api/actions/features/get_features_spec.rb
746
760
  - spec/opensearch/api/actions/features/reset_features_spec.rb
747
761
  - spec/opensearch/api/actions/field_caps_spec.rb
762
+ - spec/opensearch/api/actions/get_all_pits_spec.rb
748
763
  - spec/opensearch/api/actions/get_document_source_spec.rb
749
764
  - spec/opensearch/api/actions/get_document_spec.rb
750
765
  - spec/opensearch/api/actions/get_script_spec.rb
@@ -803,7 +818,6 @@ test_files:
803
818
  - spec/opensearch/api/actions/nodes/reload_secure_settings_spec.rb
804
819
  - spec/opensearch/api/actions/nodes/shutdown_spec.rb
805
820
  - spec/opensearch/api/actions/nodes/stats_spec.rb
806
- - spec/opensearch/api/actions/open_point_in_time_spec.rb
807
821
  - spec/opensearch/api/actions/ping_spec.rb
808
822
  - spec/opensearch/api/actions/put_script_spec.rb
809
823
  - spec/opensearch/api/actions/reindex_spec.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,50 +0,0 @@
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
- # Licensed to Elasticsearch B.V. under one or more contributor
11
- # license agreements. See the NOTICE file distributed with
12
- # this work for additional information regarding copyright
13
- # ownership. Elasticsearch B.V. licenses this file to you under
14
- # the Apache License, Version 2.0 (the "License"); you may
15
- # not use this file except in compliance with the License.
16
- # You may obtain a copy of the License at
17
- #
18
- # http://www.apache.org/licenses/LICENSE-2.0
19
- #
20
- # Unless required by applicable law or agreed to in writing,
21
- # software distributed under the License is distributed on an
22
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
- # KIND, either express or implied. See the License for the
24
- # specific language governing permissions and limitations
25
- # under the License.
26
-
27
- module OpenSearch
28
- module API
29
- module Actions
30
- # Close a point in time
31
- #
32
- # @option arguments [Hash] :headers Custom HTTP headers
33
- # @option arguments [Hash] :body a point-in-time id to close
34
- #
35
- #
36
- def close_point_in_time(arguments = {})
37
- headers = arguments.delete(:headers) || {}
38
-
39
- arguments = arguments.clone
40
-
41
- method = OpenSearch::API::HTTP_DELETE
42
- path = "_pit"
43
- params = {}
44
-
45
- body = arguments[:body]
46
- perform_request(method, path, params, body, headers).body
47
- end
48
- end
49
- end
50
- end
@@ -1,72 +0,0 @@
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
- # Licensed to Elasticsearch B.V. under one or more contributor
11
- # license agreements. See the NOTICE file distributed with
12
- # this work for additional information regarding copyright
13
- # ownership. Elasticsearch B.V. licenses this file to you under
14
- # the Apache License, Version 2.0 (the "License"); you may
15
- # not use this file except in compliance with the License.
16
- # You may obtain a copy of the License at
17
- #
18
- # http://www.apache.org/licenses/LICENSE-2.0
19
- #
20
- # Unless required by applicable law or agreed to in writing,
21
- # software distributed under the License is distributed on an
22
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
- # KIND, either express or implied. See the License for the
24
- # specific language governing permissions and limitations
25
- # under the License.
26
-
27
- module OpenSearch
28
- module API
29
- module Actions
30
- # Open a point in time that can be used in subsequent searches
31
- #
32
- # @option arguments [List] :index A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices
33
- # @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
34
- # @option arguments [String] :routing Specific routing value
35
- # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
36
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
37
- # @option arguments [String] :keep_alive Specific the time to live for the point in time
38
- # @option arguments [Hash] :headers Custom HTTP headers
39
- #
40
- #
41
- def open_point_in_time(arguments = {})
42
- headers = arguments.delete(:headers) || {}
43
-
44
- arguments = arguments.clone
45
-
46
- _index = arguments.delete(:index)
47
-
48
- method = OpenSearch::API::HTTP_POST
49
- path = if _index
50
- "#{Utils.__listify(_index)}/_pit"
51
- else
52
- "_pit"
53
- end
54
- params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
55
-
56
- body = nil
57
- perform_request(method, path, params, body, headers).body
58
- end
59
-
60
- # Register this action with its valid params when the module is loaded.
61
- #
62
- # @since 6.2.0
63
- ParamsRegistry.register(:open_point_in_time, [
64
- :preference,
65
- :routing,
66
- :ignore_unavailable,
67
- :expand_wildcards,
68
- :keep_alive
69
- ].freeze)
70
- end
71
- end
72
- end
@@ -1,43 +0,0 @@
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
- # Licensed to Elasticsearch B.V. under one or more contributor
11
- # license agreements. See the NOTICE file distributed with
12
- # this work for additional information regarding copyright
13
- # ownership. Elasticsearch B.V. licenses this file to you under
14
- # the Apache License, Version 2.0 (the "License"); you may
15
- # not use this file except in compliance with the License.
16
- # You may obtain a copy of the License at
17
- #
18
- # http://www.apache.org/licenses/LICENSE-2.0
19
- #
20
- # Unless required by applicable law or agreed to in writing,
21
- # software distributed under the License is distributed on an
22
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
- # KIND, either express or implied. See the License for the
24
- # specific language governing permissions and limitations
25
- # under the License.
26
-
27
- require 'spec_helper'
28
-
29
- describe 'client#close_point_in_time' do
30
- let(:expected_args) do
31
- [
32
- 'DELETE',
33
- '_pit',
34
- {},
35
- nil,
36
- {}
37
- ]
38
- end
39
-
40
- it 'performs the request' do
41
- expect(client_double.close_point_in_time).to eq({})
42
- end
43
- end