opensearch-api 1.0.0 → 2.1.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 (136) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Gemfile +2 -2
  4. data/README.md +3 -3
  5. data/Rakefile +3 -3
  6. data/lib/opensearch/api/actions/benchmark.rb +0 -1
  7. data/lib/opensearch/api/actions/bulk.rb +1 -7
  8. data/lib/opensearch/api/actions/cat/allocation.rb +4 -2
  9. data/lib/opensearch/api/actions/cat/cluster_manager.rb +54 -0
  10. data/lib/opensearch/api/actions/cat/indices.rb +4 -2
  11. data/lib/opensearch/api/actions/cat/master.rb +3 -1
  12. data/lib/opensearch/api/actions/cat/nodeattrs.rb +4 -2
  13. data/lib/opensearch/api/actions/cat/nodes.rb +4 -2
  14. data/lib/opensearch/api/actions/cat/pending_tasks.rb +4 -2
  15. data/lib/opensearch/api/actions/cat/plugins.rb +4 -2
  16. data/lib/opensearch/api/actions/cat/repositories.rb +4 -2
  17. data/lib/opensearch/api/actions/cat/shards.rb +4 -2
  18. data/lib/opensearch/api/actions/cat/snapshots.rb +3 -1
  19. data/lib/opensearch/api/actions/cat/templates.rb +4 -2
  20. data/lib/opensearch/api/actions/cat/thread_pool.rb +4 -2
  21. data/lib/opensearch/api/actions/cluster/delete_component_template.rb +4 -2
  22. data/lib/opensearch/api/actions/cluster/exists_component_template.rb +4 -2
  23. data/lib/opensearch/api/actions/cluster/get_component_template.rb +4 -2
  24. data/lib/opensearch/api/actions/cluster/get_settings.rb +3 -1
  25. data/lib/opensearch/api/actions/cluster/health.rb +4 -2
  26. data/lib/opensearch/api/actions/cluster/pending_tasks.rb +5 -3
  27. data/lib/opensearch/api/actions/cluster/put_component_template.rb +4 -2
  28. data/lib/opensearch/api/actions/cluster/put_settings.rb +3 -1
  29. data/lib/opensearch/api/actions/cluster/reroute.rb +4 -2
  30. data/lib/opensearch/api/actions/cluster/state.rb +4 -2
  31. data/lib/opensearch/api/actions/count.rb +1 -6
  32. data/lib/opensearch/api/actions/create.rb +0 -1
  33. data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +4 -2
  34. data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +4 -2
  35. data/lib/opensearch/api/actions/delete.rb +1 -8
  36. data/lib/opensearch/api/actions/delete_by_query.rb +1 -8
  37. data/lib/opensearch/api/actions/delete_script.rb +4 -2
  38. data/lib/opensearch/api/actions/exists.rb +1 -8
  39. data/lib/opensearch/api/actions/exists_source.rb +1 -8
  40. data/lib/opensearch/api/actions/explain.rb +1 -8
  41. data/lib/opensearch/api/actions/features/get_features.rb +4 -2
  42. data/lib/opensearch/api/actions/get.rb +1 -8
  43. data/lib/opensearch/api/actions/get_script.rb +4 -2
  44. data/lib/opensearch/api/actions/get_source.rb +1 -8
  45. data/lib/opensearch/api/actions/index.rb +1 -8
  46. data/lib/opensearch/api/actions/indices/add_block.rb +3 -1
  47. data/lib/opensearch/api/actions/indices/clone.rb +3 -1
  48. data/lib/opensearch/api/actions/indices/close.rb +3 -1
  49. data/lib/opensearch/api/actions/indices/create.rb +4 -4
  50. data/lib/opensearch/api/actions/indices/delete.rb +3 -1
  51. data/lib/opensearch/api/actions/indices/delete_alias.rb +4 -2
  52. data/lib/opensearch/api/actions/indices/delete_index_template.rb +4 -2
  53. data/lib/opensearch/api/actions/indices/delete_template.rb +4 -2
  54. data/lib/opensearch/api/actions/indices/exists_index_template.rb +4 -2
  55. data/lib/opensearch/api/actions/indices/exists_template.rb +4 -2
  56. data/lib/opensearch/api/actions/indices/get.rb +4 -4
  57. data/lib/opensearch/api/actions/indices/get_field_mapping.rb +1 -10
  58. data/lib/opensearch/api/actions/indices/get_index_template.rb +4 -2
  59. data/lib/opensearch/api/actions/indices/get_mapping.rb +5 -12
  60. data/lib/opensearch/api/actions/indices/get_settings.rb +3 -1
  61. data/lib/opensearch/api/actions/indices/get_template.rb +4 -4
  62. data/lib/opensearch/api/actions/indices/open.rb +3 -1
  63. data/lib/opensearch/api/actions/indices/put_alias.rb +4 -2
  64. data/lib/opensearch/api/actions/indices/put_index_template.rb +4 -2
  65. data/lib/opensearch/api/actions/indices/put_mapping.rb +4 -13
  66. data/lib/opensearch/api/actions/indices/put_settings.rb +3 -1
  67. data/lib/opensearch/api/actions/indices/put_template.rb +4 -4
  68. data/lib/opensearch/api/actions/indices/rollover.rb +3 -3
  69. data/lib/opensearch/api/actions/indices/shrink.rb +3 -1
  70. data/lib/opensearch/api/actions/indices/simulate_index_template.rb +4 -2
  71. data/lib/opensearch/api/actions/indices/simulate_template.rb +4 -2
  72. data/lib/opensearch/api/actions/indices/split.rb +3 -1
  73. data/lib/opensearch/api/actions/indices/update_aliases.rb +4 -2
  74. data/lib/opensearch/api/actions/indices/validate_query.rb +1 -6
  75. data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +3 -1
  76. data/lib/opensearch/api/actions/ingest/get_pipeline.rb +4 -2
  77. data/lib/opensearch/api/actions/ingest/put_pipeline.rb +3 -1
  78. data/lib/opensearch/api/actions/mget.rb +2 -7
  79. data/lib/opensearch/api/actions/msearch.rb +1 -6
  80. data/lib/opensearch/api/actions/msearch_template.rb +1 -6
  81. data/lib/opensearch/api/actions/mtermvectors.rb +1 -6
  82. data/lib/opensearch/api/actions/put_script.rb +3 -1
  83. data/lib/opensearch/api/actions/search.rb +1 -7
  84. data/lib/opensearch/api/actions/search_shards.rb +1 -1
  85. data/lib/opensearch/api/actions/search_template.rb +1 -6
  86. data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +3 -1
  87. data/lib/opensearch/api/actions/snapshot/clone.rb +4 -2
  88. data/lib/opensearch/api/actions/snapshot/create.rb +3 -1
  89. data/lib/opensearch/api/actions/snapshot/create_repository.rb +3 -1
  90. data/lib/opensearch/api/actions/snapshot/delete.rb +4 -2
  91. data/lib/opensearch/api/actions/snapshot/delete_repository.rb +3 -1
  92. data/lib/opensearch/api/actions/snapshot/get.rb +3 -1
  93. data/lib/opensearch/api/actions/snapshot/get_features.rb +4 -2
  94. data/lib/opensearch/api/actions/snapshot/get_repository.rb +3 -2
  95. data/lib/opensearch/api/actions/snapshot/restore.rb +3 -1
  96. data/lib/opensearch/api/actions/snapshot/status.rb +3 -1
  97. data/lib/opensearch/api/actions/snapshot/verify_repository.rb +3 -1
  98. data/lib/opensearch/api/actions/termvectors.rb +1 -8
  99. data/lib/opensearch/api/actions/update.rb +1 -8
  100. data/lib/opensearch/api/actions/update_by_query.rb +1 -8
  101. data/lib/opensearch/api/utils.rb +5 -5
  102. data/lib/opensearch/api/version.rb +1 -1
  103. data/lib/opensearch/api.rb +1 -1
  104. data/opensearch-api.gemspec +0 -1
  105. data/spec/opensearch/api/actions/bulk_spec.rb +10 -21
  106. data/spec/opensearch/api/actions/cat/allocation_spec.rb +6 -7
  107. data/spec/opensearch/api/actions/cat/cluster_manager_spec.rb +26 -0
  108. data/spec/opensearch/api/actions/count_spec.rb +3 -3
  109. data/spec/opensearch/api/actions/create_document_spec.rb +8 -8
  110. data/spec/opensearch/api/actions/delete_by_query_spec.rb +0 -17
  111. data/spec/opensearch/api/actions/delete_document_spec.rb +10 -10
  112. data/spec/opensearch/api/actions/exists_document_spec.rb +10 -10
  113. data/spec/opensearch/api/actions/explain_document_spec.rb +8 -8
  114. data/spec/opensearch/api/actions/get_document_source_spec.rb +6 -6
  115. data/spec/opensearch/api/actions/get_document_spec.rb +8 -8
  116. data/spec/opensearch/api/actions/get_script_spec.rb +2 -2
  117. data/spec/opensearch/api/actions/hashie_spec.rb +0 -2
  118. data/spec/opensearch/api/actions/index_document_spec.rb +12 -12
  119. data/spec/opensearch/api/actions/indices/clone_spec.rb +2 -2
  120. data/spec/opensearch/api/actions/indices/get_field_mapping_spec.rb +0 -11
  121. data/spec/opensearch/api/actions/indices/get_mapping_spec.rb +5 -16
  122. data/spec/opensearch/api/actions/indices/put_mapping_spec.rb +8 -21
  123. data/spec/opensearch/api/actions/indices/validate_query_spec.rb +0 -10
  124. data/spec/opensearch/api/actions/mget_spec.rb +2 -17
  125. data/spec/opensearch/api/actions/mtermvectors_spec.rb +3 -3
  126. data/spec/opensearch/api/actions/search_spec.rb +5 -16
  127. data/spec/opensearch/api/actions/termvectors_spec.rb +5 -5
  128. data/spec/opensearch/api/actions/update_document_spec.rb +11 -11
  129. data/spec/opensearch/api/utils_spec.rb +7 -14
  130. data.tar.gz.sig +0 -0
  131. metadata +14 -31
  132. metadata.gz.sig +0 -0
  133. data/lib/opensearch/api/actions/indices/exists_type.rb +0 -79
  134. data/lib/opensearch/api/actions/indices/flush_synced.rb +0 -79
  135. data/spec/opensearch/api/actions/indices/exists_type_spec.rb +0 -117
  136. data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +0 -99
@@ -31,7 +31,7 @@ describe 'client#delete' do
31
31
  let(:expected_args) do
32
32
  [
33
33
  'DELETE',
34
- 'foo/bar/1',
34
+ 'foo/_doc/1',
35
35
  params,
36
36
  nil,
37
37
  {}
@@ -48,18 +48,18 @@ describe 'client#delete' do
48
48
 
49
49
  it 'requires the :index argument' do
50
50
  expect {
51
- client.delete(type: 'bar', id: '1')
51
+ client.delete(id: '1')
52
52
  }.to raise_exception(ArgumentError)
53
53
  end
54
54
 
55
55
  it 'requires the :id argument' do
56
56
  expect {
57
- client.delete(index: 'foo', type: 'bar')
57
+ client.delete(index: 'foo')
58
58
  }.to raise_exception(ArgumentError)
59
59
  end
60
60
 
61
61
  it 'performs the request' do
62
- expect(client_double.delete(index: 'foo', type: 'bar', id: '1')).to eq({})
62
+ expect(client_double.delete(index: 'foo', id: '1')).to eq({})
63
63
  end
64
64
 
65
65
  context 'when url params are provided' do
@@ -69,7 +69,7 @@ describe 'client#delete' do
69
69
  end
70
70
 
71
71
  it 'performs the request' do
72
- expect(client_double.delete(index: 'foo', type: 'bar', id: '1', routing: 'abc123')).to eq({})
72
+ expect(client_double.delete(index: 'foo', id: '1', routing: 'abc123')).to eq({})
73
73
  end
74
74
  end
75
75
 
@@ -77,7 +77,7 @@ describe 'client#delete' do
77
77
 
78
78
  it 'raises an ArgumentError' do
79
79
  expect {
80
- client.delete(index: 'foo', type: 'bar', id: '1', qwertypoiuy: 'asdflkjhg')
80
+ client.delete(index: 'foo', id: '1', qwertypoiuy: 'asdflkjhg')
81
81
  }.to raise_exception(ArgumentError)
82
82
  end
83
83
  end
@@ -87,7 +87,7 @@ describe 'client#delete' do
87
87
  let(:expected_args) do
88
88
  [
89
89
  'DELETE',
90
- 'foo%5Ebar/bar%2Fbam/1',
90
+ 'foo%5Ebar/_doc/1',
91
91
  params,
92
92
  nil,
93
93
  {}
@@ -95,7 +95,7 @@ describe 'client#delete' do
95
95
  end
96
96
 
97
97
  it 'escapes the url params' do
98
- expect(client_double.delete(index: 'foo^bar', type: 'bar/bam', id: 1)).to eq({})
98
+ expect(client_double.delete(index: 'foo^bar', id: 1)).to eq({})
99
99
  end
100
100
  end
101
101
 
@@ -107,14 +107,14 @@ describe 'client#delete' do
107
107
 
108
108
  it 'raises the exception' do
109
109
  expect {
110
- client.delete(index: 'foo', type: 'bar', id: 'XXX')
110
+ client.delete(index: 'foo', id: 'XXX')
111
111
  }.to raise_exception(NotFound)
112
112
  end
113
113
 
114
114
  context 'when the :ignore option is provided' do
115
115
 
116
116
  it 'does not raise the NotFound exception' do
117
- expect(client.delete(index: 'foo', type: 'bar', id: 1, ignore: 404)).to eq(false)
117
+ expect(client.delete(index: 'foo', id: 1, ignore: 404)).to eq(false)
118
118
  end
119
119
  end
120
120
  end
@@ -43,7 +43,7 @@ describe 'client#exists' do
43
43
  end
44
44
 
45
45
  let(:url) do
46
- 'foo/bar/1'
46
+ 'foo/_doc/1'
47
47
  end
48
48
 
49
49
  let(:client) do
@@ -52,13 +52,13 @@ describe 'client#exists' do
52
52
 
53
53
  it 'requires the :index argument' do
54
54
  expect {
55
- client.exists(type: 'bar', id: '1')
55
+ client.exists(id: '1')
56
56
  }.to raise_exception(ArgumentError)
57
57
  end
58
58
 
59
59
  it 'requires the :id argument' do
60
60
  expect {
61
- client.exists(index: 'foo', type: 'bar')
61
+ client.exists(index: 'foo')
62
62
  }.to raise_exception(ArgumentError)
63
63
  end
64
64
 
@@ -74,7 +74,7 @@ describe 'client#exists' do
74
74
  end
75
75
 
76
76
  it 'is aliased to a predicated method' do
77
- expect(client_double.exists?(index: 'foo', type: 'bar', id: '1')).to eq(true)
77
+ expect(client_double.exists?(index: 'foo', id: '1')).to eq(true)
78
78
  end
79
79
 
80
80
  context 'when URL parameters are provided' do
@@ -84,18 +84,18 @@ describe 'client#exists' do
84
84
  end
85
85
 
86
86
  it 'passes the parameters' do
87
- expect(client_double.exists(index: 'foo', type: 'bar', id: '1', routing: 'abc123')).to eq(true)
87
+ expect(client_double.exists(index: 'foo', id: '1', routing: 'abc123')).to eq(true)
88
88
  end
89
89
  end
90
90
 
91
91
  context 'when the request needs to be URL-escaped' do
92
92
 
93
93
  let(:url) do
94
- 'foo/bar%2Fbam/1'
94
+ 'foo%5Ebar/_doc/1'
95
95
  end
96
96
 
97
97
  it 'URL-escapes the characters' do
98
- expect(client_double.exists(index: 'foo', type: 'bar/bam', id: '1')).to eq(true)
98
+ expect(client_double.exists(index: 'foo^bar', id: '1')).to eq(true)
99
99
  end
100
100
  end
101
101
 
@@ -106,7 +106,7 @@ describe 'client#exists' do
106
106
  end
107
107
 
108
108
  it 'returns false' do
109
- expect(client_double.exists(index: 'foo', type: 'bar', id: '1')).to eq(false)
109
+ expect(client_double.exists(index: 'foo', id: '1')).to eq(false)
110
110
  end
111
111
  end
112
112
 
@@ -117,7 +117,7 @@ describe 'client#exists' do
117
117
  end
118
118
 
119
119
  it 'returns false' do
120
- expect(client_double.exists(index: 'foo', type: 'bar', id: '1')).to eq(false)
120
+ expect(client_double.exists(index: 'foo', id: '1')).to eq(false)
121
121
  end
122
122
  end
123
123
 
@@ -129,7 +129,7 @@ describe 'client#exists' do
129
129
 
130
130
  it 'raises the error' do
131
131
  expect {
132
- client_double.exists(index: 'foo', type: 'bar', id: '1')
132
+ client_double.exists(index: 'foo', id: '1')
133
133
  }.to raise_exception(StandardError)
134
134
  end
135
135
  end
@@ -48,7 +48,7 @@ describe 'client#explain' do
48
48
  end
49
49
 
50
50
  let(:url) do
51
- 'foo/bar/1/_explain'
51
+ 'foo/_explain/1'
52
52
  end
53
53
 
54
54
  let(:client) do
@@ -57,18 +57,18 @@ describe 'client#explain' do
57
57
 
58
58
  it 'requires the :index argument' do
59
59
  expect {
60
- client.explain(type: 'bar', id: '1')
60
+ client.explain(id: '1')
61
61
  }.to raise_exception(ArgumentError)
62
62
  end
63
63
 
64
64
  it 'requires the :id argument' do
65
65
  expect {
66
- client.explain(index: 'foo', type: 'bar')
66
+ client.explain(index: 'foo')
67
67
  }.to raise_exception(ArgumentError)
68
68
  end
69
69
 
70
70
  it 'performs the request' do
71
- expect(client_double.explain(index: 'foo', type: 'bar', id: 1, body: {})).to eq({})
71
+ expect(client_double.explain(index: 'foo', id: 1, body: {})).to eq({})
72
72
  end
73
73
 
74
74
  context 'when a query is provided' do
@@ -82,7 +82,7 @@ describe 'client#explain' do
82
82
  end
83
83
 
84
84
  it 'passes the query' do
85
- expect(client_double.explain(index: 'foo', type: 'bar', id: '1', q: 'abc123')).to eq({})
85
+ expect(client_double.explain(index: 'foo', id: '1', q: 'abc123')).to eq({})
86
86
  end
87
87
  end
88
88
 
@@ -92,17 +92,17 @@ describe 'client#explain' do
92
92
  end
93
93
 
94
94
  it 'passes the query definition' do
95
- expect(client_double.explain(index: 'foo', type: 'bar', id: '1', body: { query: { match: {} } })).to eq({})
95
+ expect(client_double.explain(index: 'foo', id: '1', body: { query: { match: {} } })).to eq({})
96
96
  end
97
97
  end
98
98
 
99
99
  context 'when the request needs to be URL-escaped' do
100
100
  let(:url) do
101
- 'foo%5Ebar/bar%2Fbam/1/_explain'
101
+ 'foo%5Ebar/_explain/1'
102
102
  end
103
103
 
104
104
  it 'URL-escapes the parts' do
105
- expect(client_double.explain(index: 'foo^bar', type: 'bar/bam', id: '1', body: { })).to eq({})
105
+ expect(client_double.explain(index: 'foo^bar', id: '1', body: { })).to eq({})
106
106
  end
107
107
  end
108
108
  end
@@ -43,7 +43,7 @@ describe 'client#get_source' do
43
43
  end
44
44
 
45
45
  let(:url) do
46
- 'foo/bar/1/_source'
46
+ 'foo/_source/1'
47
47
  end
48
48
 
49
49
  let(:client) do
@@ -52,13 +52,13 @@ describe 'client#get_source' do
52
52
 
53
53
  it 'requires the :index argument' do
54
54
  expect {
55
- client.get_source(type: 'bar', id: '1')
55
+ client.get_source(id: '1')
56
56
  }.to raise_exception(ArgumentError)
57
57
  end
58
58
 
59
59
  it 'requires the :id argument' do
60
60
  expect {
61
- client.get_source(index: 'foo', type: 'bar')
61
+ client.get_source(index: 'foo')
62
62
  }.to raise_exception(ArgumentError)
63
63
  end
64
64
 
@@ -80,18 +80,18 @@ describe 'client#get_source' do
80
80
  end
81
81
 
82
82
  it 'Passes the URL params' do
83
- expect(client_double.get_source(index: 'foo', type: 'bar', id: '1', routing: 'abc123')).to eq({})
83
+ expect(client_double.get_source(index: 'foo', id: '1', routing: 'abc123')).to eq({})
84
84
  end
85
85
  end
86
86
 
87
87
  context 'when the request needs to be URL-escaped' do
88
88
 
89
89
  let(:url) do
90
- 'foo%5Ebar/bar%2Fbam/1/_source'
90
+ 'foo%5Ebar/_source/1'
91
91
  end
92
92
 
93
93
  it 'URL-escapes the parts' do
94
- expect(client_double.get_source(index: 'foo^bar', type: 'bar/bam', id: '1')).to eq({})
94
+ expect(client_double.get_source(index: 'foo^bar', id: '1')).to eq({})
95
95
  end
96
96
  end
97
97
 
@@ -43,7 +43,7 @@ describe 'client#get' do
43
43
  end
44
44
 
45
45
  let(:url) do
46
- 'foo/bar/1'
46
+ 'foo/_doc/1'
47
47
  end
48
48
 
49
49
  let(:client) do
@@ -52,13 +52,13 @@ describe 'client#get' do
52
52
 
53
53
  it 'requires the :index argument' do
54
54
  expect {
55
- client.get(type: 'bar', id: '1')
55
+ client.get(id: '1')
56
56
  }.to raise_exception(ArgumentError)
57
57
  end
58
58
 
59
59
  it 'requires the :id argument' do
60
60
  expect {
61
- client.get(index: 'foo', type: 'bar')
61
+ client.get(index: 'foo')
62
62
  }.to raise_exception(ArgumentError)
63
63
  end
64
64
 
@@ -80,7 +80,7 @@ describe 'client#get' do
80
80
  end
81
81
 
82
82
  it 'Passes the URL params' do
83
- expect(client_double.get(index: 'foo', type: 'bar', id: '1', routing: 'abc123')).to eq({})
83
+ expect(client_double.get(index: 'foo', id: '1', routing: 'abc123')).to eq({})
84
84
  end
85
85
  end
86
86
 
@@ -88,7 +88,7 @@ describe 'client#get' do
88
88
 
89
89
  it 'Passes the URL params' do
90
90
  expect {
91
- client.get(index: 'foo', type: 'bar', id: '1', qwert: 'abc123')
91
+ client.get(index: 'foo', id: '1', qwert: 'abc123')
92
92
  }.to raise_exception(ArgumentError)
93
93
  end
94
94
  end
@@ -96,11 +96,11 @@ describe 'client#get' do
96
96
  context 'when the request needs to be URL-escaped' do
97
97
 
98
98
  let(:url) do
99
- 'foo%5Ebar/bar%2Fbam/1'
99
+ 'foo%5Ebar/_doc/1'
100
100
  end
101
101
 
102
102
  it 'URL-escapes the parts' do
103
- expect(client_double.get(index: 'foo^bar', type: 'bar/bam', id: '1')).to eq({})
103
+ expect(client_double.get(index: 'foo^bar', id: '1')).to eq({})
104
104
  end
105
105
  end
106
106
 
@@ -125,7 +125,7 @@ describe 'client#get' do
125
125
  end
126
126
 
127
127
  it 'returns false' do
128
- expect(client.get(index: 'foo', type: 'bar', id: '1', ignore: 404)).to eq(false)
128
+ expect(client.get(index: 'foo', id: '1', ignore: 404)).to eq(false)
129
129
  end
130
130
  end
131
131
  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,
@@ -47,7 +47,7 @@ describe 'client#index' do
47
47
  end
48
48
 
49
49
  let(:url) do
50
- 'foo/bar'
50
+ 'foo/_doc'
51
51
  end
52
52
 
53
53
  let(:body) do
@@ -60,12 +60,12 @@ describe 'client#index' do
60
60
 
61
61
  it 'requires the :index argument' do
62
62
  expect {
63
- client.index(type: 'bar')
63
+ client.index()
64
64
  }.to raise_exception(ArgumentError)
65
65
  end
66
66
 
67
67
  it 'performs the request' do
68
- expect(client_double.index(index: 'foo', type: 'bar', body: body)).to eq({})
68
+ expect(client_double.index(index: 'foo', body: body)).to eq({})
69
69
  end
70
70
 
71
71
  context 'when a specific id is provided' do
@@ -75,11 +75,11 @@ describe 'client#index' do
75
75
  end
76
76
 
77
77
  let(:url) do
78
- 'foo/bar/1'
78
+ 'foo/_doc/1'
79
79
  end
80
80
 
81
81
  it 'performs the request' do
82
- expect(client_double.index(index: 'foo', type: 'bar', id: '1', body: body)).to eq({})
82
+ expect(client_double.index(index: 'foo', id: '1', body: body)).to eq({})
83
83
  end
84
84
  end
85
85
 
@@ -90,7 +90,7 @@ describe 'client#index' do
90
90
  end
91
91
 
92
92
  let(:url) do
93
- 'foo/bar'
93
+ 'foo/_doc'
94
94
  end
95
95
 
96
96
  let(:params) do
@@ -98,7 +98,7 @@ describe 'client#index' do
98
98
  end
99
99
 
100
100
  it 'passes the URL params' do
101
- expect(client_double.index(index: 'foo', type: 'bar', op_type: 'create', body: body)).to eq({})
101
+ expect(client_double.index(index: 'foo', op_type: 'create', body: body)).to eq({})
102
102
  end
103
103
 
104
104
  context 'when a specific id is provided' do
@@ -108,7 +108,7 @@ describe 'client#index' do
108
108
  end
109
109
 
110
110
  let(:url) do
111
- 'foo/bar/1'
111
+ 'foo/_doc/1'
112
112
  end
113
113
 
114
114
  let(:params) do
@@ -116,7 +116,7 @@ describe 'client#index' do
116
116
  end
117
117
 
118
118
  it 'passes the URL params' do
119
- expect(client_double.index(index: 'foo', type: 'bar', id: '1', op_type: 'create', body: body)).to eq({})
119
+ expect(client_double.index(index: 'foo', id: '1', op_type: 'create', body: body)).to eq({})
120
120
  end
121
121
  end
122
122
  end
@@ -127,11 +127,11 @@ describe 'client#index' do
127
127
  end
128
128
 
129
129
  let(:url) do
130
- 'foo/bar%2Fbam/123'
130
+ 'foo%5Ebar/_doc/123'
131
131
  end
132
132
 
133
133
  it 'URL-escapes the parts' do
134
- expect(client_double.index(index: 'foo', type: 'bar/bam', id: '123', body: body)).to eq({})
134
+ expect(client_double.index(index: 'foo^bar', id: '123', body: body)).to eq({})
135
135
  end
136
136
  end
137
137
 
@@ -139,7 +139,7 @@ describe 'client#index' do
139
139
 
140
140
  it 'raises and ArgumentError' do
141
141
  expect {
142
- client.index(index: 'foo', type: 'bar', id: '1', qwerty: 'yuiop')
142
+ client.index(index: 'foo', id: '1', qwerty: 'yuiop')
143
143
  }.to raise_exception(ArgumentError)
144
144
  end
145
145
  end
@@ -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
@@ -56,15 +56,4 @@ describe 'client.cluster#get_field_mapping' do
56
56
  expect(client_double.indices.get_field_mapping(index: 'foo', field: 'bam')).to eq({})
57
57
  end
58
58
  end
59
-
60
- context 'when a type is specified' do
61
-
62
- let(:url) do
63
- 'foo/_mapping/bar/field/bam'
64
- end
65
-
66
- it 'performs the request' do
67
- expect(client_double.indices.get_field_mapping(index: 'foo', type: 'bar', field: 'bam')).to eq({})
68
- end
69
- end
70
59
  end
@@ -57,36 +57,25 @@ describe 'client.cluster#get_mapping' do
57
57
  end
58
58
  end
59
59
 
60
- context 'when an index and type are specified' do
60
+ context 'when multiple indices are specified' do
61
61
 
62
62
  let(:url) do
63
- 'foo/_mapping/bar'
63
+ 'foo,bar/_mapping'
64
64
  end
65
65
 
66
66
  it 'performs the request' do
67
- expect(client_double.indices.get_mapping(index: 'foo', type: 'bar')).to eq({})
68
- end
69
- end
70
-
71
- context 'when multiple indices and types are specified' do
72
-
73
- let(:url) do
74
- 'foo,bar/_mapping/bam,baz'
75
- end
76
-
77
- it 'performs the request' do
78
- expect(client_double.indices.get_mapping(index: ['foo', 'bar'], type: ['bam', 'baz'])).to eq({})
67
+ expect(client_double.indices.get_mapping(index: ['foo', 'bar'])).to eq({})
79
68
  end
80
69
  end
81
70
 
82
71
  context 'when the path must be URL-escaped' do
83
72
 
84
73
  let(:url) do
85
- 'foo%5Ebar/_mapping/bar%2Fbam'
74
+ 'foo%5Ebar/_mapping'
86
75
  end
87
76
 
88
77
  it 'performs the request' do
89
- expect(client_double.indices.get_mapping(index: 'foo^bar', type: 'bar/bam')).to eq({})
78
+ expect(client_double.indices.get_mapping(index: 'foo^bar')).to eq({})
90
79
  end
91
80
  end
92
81
  end
@@ -39,7 +39,7 @@ describe 'client.cluster#put_mapping' do
39
39
  end
40
40
 
41
41
  let(:url) do
42
- 'foo/bar/_mappings'
42
+ 'foo/_mappings'
43
43
  end
44
44
 
45
45
  let(:body) do
@@ -47,20 +47,7 @@ describe 'client.cluster#put_mapping' do
47
47
  end
48
48
 
49
49
  it 'performs the request' do
50
- expect(client_double.indices.put_mapping(index: 'foo', type: 'bar', body: {})).to eq({})
51
- end
52
-
53
- context 'when there is no type specified' do
54
-
55
- let(:client) do
56
- Class.new { include OpenSearch::API }.new
57
- end
58
-
59
- it 'raises an exception' do
60
- expect {
61
- client.indices.put_mapping(type: 'foo')
62
- }.to raise_exception(ArgumentError)
63
- end
50
+ expect(client_double.indices.put_mapping(index: 'foo', body: {})).to eq({})
64
51
  end
65
52
 
66
53
  context 'when there is no body specified' do
@@ -71,7 +58,7 @@ describe 'client.cluster#put_mapping' do
71
58
 
72
59
  it 'raises an exception' do
73
60
  expect {
74
- client.indices.put_mapping(index: 'foo', type: 'bar')
61
+ client.indices.put_mapping(index: 'foo')
75
62
  }.to raise_exception(ArgumentError)
76
63
  end
77
64
  end
@@ -83,29 +70,29 @@ describe 'client.cluster#put_mapping' do
83
70
  end
84
71
 
85
72
  it 'performs the request' do
86
- expect(client_double.indices.put_mapping(index: 'foo', type: 'bar', body: { filter: 'foo' })).to eq({})
73
+ expect(client_double.indices.put_mapping(index: 'foo', body: { filter: 'foo' })).to eq({})
87
74
  end
88
75
  end
89
76
 
90
77
  context 'when multiple indices are specified' do
91
78
 
92
79
  let(:url) do
93
- 'foo,bar/bam/_mappings'
80
+ 'foo,bar/_mappings'
94
81
  end
95
82
 
96
83
  it 'performs the request' do
97
- expect(client_double.indices.put_mapping(index: ['foo','bar'], type: 'bam', body: {})).to eq({})
84
+ expect(client_double.indices.put_mapping(index: ['foo','bar'], body: {})).to eq({})
98
85
  end
99
86
  end
100
87
 
101
88
  context 'when the path needs to be URL-escaped' do
102
89
 
103
90
  let(:url) do
104
- 'foo%5Ebar/bar%2Fbam/_mappings'
91
+ 'foo%5Ebar/_mappings'
105
92
  end
106
93
 
107
94
  it 'performs the request' do
108
- expect(client_double.indices.put_mapping(index: 'foo^bar', type: 'bar/bam', body: {})).to eq({})
95
+ expect(client_double.indices.put_mapping(index: 'foo^bar', body: {})).to eq({})
109
96
  end
110
97
  end
111
98
  end
@@ -64,16 +64,6 @@ describe 'client.cluster#validate_query' do
64
64
  end
65
65
  end
66
66
 
67
- context 'when a type and index are specified' do
68
- let(:url) do
69
- 'foo/bar/_validate/query'
70
- end
71
-
72
- it 'performs the request' do
73
- expect(client_double.indices.validate_query(index: 'foo', type: 'bar')).to eq({})
74
- end
75
- end
76
-
77
67
  context 'when multiple indicies are specified as a list' do
78
68
  let(:url) do
79
69
  'foo,bar/_validate/query'
@@ -64,21 +64,6 @@ describe 'client#mget' do
64
64
  end
65
65
  end
66
66
 
67
- context 'when a type is specified' do
68
-
69
- let(:url) do
70
- 'foo/bar/_mget'
71
- end
72
-
73
- let(:body) do
74
- { ids: [ '1', '2' ]}
75
- end
76
-
77
- it 'performs the request' do
78
- expect(client_double.mget(index: 'foo', type: 'bar', body: { :ids => [ '1', '2'] })).to eq({})
79
- end
80
- end
81
-
82
67
  context 'when url parameters are provided' do
83
68
 
84
69
  let(:params) do
@@ -97,7 +82,7 @@ describe 'client#mget' do
97
82
  context 'when the request needs to be URL-escaped' do
98
83
 
99
84
  let(:url) do
100
- 'foo%5Ebar/bar%2Fbam/_mget'
85
+ 'foo%5Ebar/_mget'
101
86
  end
102
87
 
103
88
  let(:body) do
@@ -105,7 +90,7 @@ describe 'client#mget' do
105
90
  end
106
91
 
107
92
  it 'performs the request' do
108
- expect(client_double.mget(index: 'foo^bar', type: 'bar/bam', body: { :ids => [ '1', '2'] })).to eq({})
93
+ expect(client_double.mget(index: 'foo^bar', body: { :ids => [ '1', '2'] })).to eq({})
109
94
  end
110
95
  end
111
96
  end