opensearch-api 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.md +3 -3
  4. data/lib/opensearch/api/actions/benchmark.rb +0 -1
  5. data/lib/opensearch/api/actions/bulk.rb +1 -7
  6. data/lib/opensearch/api/actions/count.rb +1 -6
  7. data/lib/opensearch/api/actions/create.rb +0 -1
  8. data/lib/opensearch/api/actions/delete.rb +1 -8
  9. data/lib/opensearch/api/actions/delete_by_query.rb +1 -8
  10. data/lib/opensearch/api/actions/exists.rb +1 -8
  11. data/lib/opensearch/api/actions/exists_source.rb +1 -8
  12. data/lib/opensearch/api/actions/explain.rb +1 -8
  13. data/lib/opensearch/api/actions/get.rb +1 -8
  14. data/lib/opensearch/api/actions/get_source.rb +1 -8
  15. data/lib/opensearch/api/actions/index.rb +1 -8
  16. data/lib/opensearch/api/actions/indices/create.rb +0 -2
  17. data/lib/opensearch/api/actions/indices/get.rb +0 -2
  18. data/lib/opensearch/api/actions/indices/get_field_mapping.rb +1 -10
  19. data/lib/opensearch/api/actions/indices/get_mapping.rb +1 -10
  20. data/lib/opensearch/api/actions/indices/get_template.rb +0 -2
  21. data/lib/opensearch/api/actions/indices/put_mapping.rb +1 -12
  22. data/lib/opensearch/api/actions/indices/put_template.rb +0 -2
  23. data/lib/opensearch/api/actions/indices/rollover.rb +0 -2
  24. data/lib/opensearch/api/actions/indices/validate_query.rb +1 -6
  25. data/lib/opensearch/api/actions/mget.rb +2 -7
  26. data/lib/opensearch/api/actions/msearch.rb +1 -6
  27. data/lib/opensearch/api/actions/msearch_template.rb +1 -6
  28. data/lib/opensearch/api/actions/mtermvectors.rb +1 -6
  29. data/lib/opensearch/api/actions/search.rb +1 -7
  30. data/lib/opensearch/api/actions/search_template.rb +1 -6
  31. data/lib/opensearch/api/actions/termvectors.rb +1 -8
  32. data/lib/opensearch/api/actions/update.rb +1 -8
  33. data/lib/opensearch/api/actions/update_by_query.rb +1 -8
  34. data/lib/opensearch/api/version.rb +1 -1
  35. data/lib/opensearch/api.rb +1 -1
  36. data/spec/opensearch/api/actions/bulk_spec.rb +10 -21
  37. data/spec/opensearch/api/actions/count_spec.rb +3 -3
  38. data/spec/opensearch/api/actions/create_document_spec.rb +8 -8
  39. data/spec/opensearch/api/actions/delete_by_query_spec.rb +0 -17
  40. data/spec/opensearch/api/actions/delete_document_spec.rb +10 -10
  41. data/spec/opensearch/api/actions/exists_document_spec.rb +10 -10
  42. data/spec/opensearch/api/actions/explain_document_spec.rb +8 -8
  43. data/spec/opensearch/api/actions/get_document_source_spec.rb +6 -6
  44. data/spec/opensearch/api/actions/get_document_spec.rb +8 -8
  45. data/spec/opensearch/api/actions/index_document_spec.rb +12 -12
  46. data/spec/opensearch/api/actions/indices/get_field_mapping_spec.rb +0 -11
  47. data/spec/opensearch/api/actions/indices/get_mapping_spec.rb +5 -16
  48. data/spec/opensearch/api/actions/indices/put_mapping_spec.rb +8 -21
  49. data/spec/opensearch/api/actions/indices/validate_query_spec.rb +0 -10
  50. data/spec/opensearch/api/actions/mget_spec.rb +2 -17
  51. data/spec/opensearch/api/actions/mtermvectors_spec.rb +3 -3
  52. data/spec/opensearch/api/actions/search_spec.rb +5 -16
  53. data/spec/opensearch/api/actions/termvectors_spec.rb +5 -5
  54. data/spec/opensearch/api/actions/update_document_spec.rb +11 -11
  55. data.tar.gz.sig +0 -0
  56. metadata +2 -8
  57. metadata.gz.sig +0 -0
  58. data/lib/opensearch/api/actions/indices/exists_type.rb +0 -79
  59. data/lib/opensearch/api/actions/indices/flush_synced.rb +0 -79
  60. data/spec/opensearch/api/actions/indices/exists_type_spec.rb +0 -117
  61. data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +0 -99
@@ -30,7 +30,6 @@ module OpenSearch
30
30
  # Returns results matching a query.
31
31
  #
32
32
  # @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
33
- # @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
34
33
  # @option arguments [String] :analyzer The analyzer to use for the query string
35
34
  # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false)
36
35
  # @option arguments [Boolean] :ccs_minimize_roundtrips Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
@@ -87,21 +86,16 @@ module OpenSearch
87
86
  headers = arguments.delete(:headers) || {}
88
87
 
89
88
  arguments = arguments.clone
90
- arguments[:index] = UNDERSCORE_ALL if !arguments[:index] && arguments[:type]
91
89
 
92
90
  _index = arguments.delete(:index)
93
91
 
94
- _type = arguments.delete(:type)
95
-
96
92
  method = if arguments[:body]
97
93
  OpenSearch::API::HTTP_POST
98
94
  else
99
95
  OpenSearch::API::HTTP_GET
100
96
  end
101
97
 
102
- path = if _index && _type
103
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_search"
104
- elsif _index
98
+ path = if _index
105
99
  "#{Utils.__listify(_index)}/_search"
106
100
  else
107
101
  "_search"
@@ -30,7 +30,6 @@ module OpenSearch
30
30
  # Allows to use the Mustache language to pre-render a search definition.
31
31
  #
32
32
  # @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
33
- # @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
34
33
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
35
34
  # @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled
36
35
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
@@ -62,12 +61,8 @@ module OpenSearch
62
61
 
63
62
  _index = arguments.delete(:index)
64
63
 
65
- _type = arguments.delete(:type)
66
-
67
64
  method = OpenSearch::API::HTTP_POST
68
- path = if _index && _type
69
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_search/template"
70
- elsif _index
65
+ path = if _index
71
66
  "#{Utils.__listify(_index)}/_search/template"
72
67
  else
73
68
  "_search/template"
@@ -31,7 +31,6 @@ module OpenSearch
31
31
  #
32
32
  # @option arguments [String] :index The index in which the document resides. (*Required*)
33
33
  # @option arguments [String] :id The id of the document, when not specified a doc param should be supplied.
34
- # @option arguments [String] :type The type of the document.
35
34
  # @option arguments [Boolean] :term_statistics Specifies if total term frequency and document frequency should be returned.
36
35
  # @option arguments [Boolean] :field_statistics Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
37
36
  # @option arguments [List] :fields A comma-separated list of fields to return.
@@ -63,8 +62,6 @@ module OpenSearch
63
62
 
64
63
  _id = arguments.delete(:id)
65
64
 
66
- _type = arguments.delete(:type)
67
-
68
65
  method = if arguments[:body]
69
66
  OpenSearch::API::HTTP_POST
70
67
  else
@@ -72,11 +69,7 @@ module OpenSearch
72
69
  end
73
70
 
74
71
  endpoint = arguments.delete(:endpoint) || '_termvectors'
75
- path = if _index && _type && _id
76
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{Utils.__listify(_id)}/#{endpoint}"
77
- elsif _index && _type
78
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{endpoint}"
79
- elsif _index && _id
72
+ path = if _index && _id
80
73
  "#{Utils.__listify(_index)}/#{endpoint}/#{Utils.__listify(_id)}"
81
74
  else
82
75
  "#{Utils.__listify(_index)}/#{endpoint}"
@@ -31,7 +31,6 @@ module OpenSearch
31
31
  #
32
32
  # @option arguments [String] :id Document ID
33
33
  # @option arguments [String] :index The name of the index
34
- # @option arguments [String] :type The type of the document *Deprecated*
35
34
  # @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
36
35
  # @option arguments [List] :_source True or false to return the _source field or not, or a list of fields to return
37
36
  # @option arguments [List] :_source_excludes A list of fields to exclude from the returned _source field
@@ -66,14 +65,8 @@ module OpenSearch
66
65
 
67
66
  _index = arguments.delete(:index)
68
67
 
69
- _type = arguments.delete(:type)
70
-
71
68
  method = OpenSearch::API::HTTP_POST
72
- path = if _index && _type && _id
73
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{Utils.__listify(_id)}/_update"
74
- else
75
- "#{Utils.__listify(_index)}/_update/#{Utils.__listify(_id)}"
76
- end
69
+ path = "#{Utils.__listify(_index)}/_update/#{Utils.__listify(_id)}"
77
70
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
78
71
 
79
72
  body = arguments[:body]
@@ -31,7 +31,6 @@ module OpenSearch
31
31
  # for example to pick up a mapping change.
32
32
  #
33
33
  # @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices (*Required*)
34
- # @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
35
34
  # @option arguments [String] :analyzer The analyzer to use for the query string
36
35
  # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false)
37
36
  # @option arguments [String] :default_operator The default operator for query string query (AND or OR) (options: AND, OR)
@@ -85,14 +84,8 @@ module OpenSearch
85
84
 
86
85
  _index = arguments.delete(:index)
87
86
 
88
- _type = arguments.delete(:type)
89
-
90
87
  method = OpenSearch::API::HTTP_POST
91
- path = if _index && _type
92
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_update_by_query"
93
- else
94
- "#{Utils.__listify(_index)}/_update_by_query"
95
- end
88
+ path = "#{Utils.__listify(_index)}/_update_by_query"
96
89
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
97
90
 
98
91
  body = arguments[:body]
@@ -26,6 +26,6 @@
26
26
 
27
27
  module OpenSearch
28
28
  module API
29
- VERSION = '1.0.0'.freeze
29
+ VERSION = '2.0.0'.freeze
30
30
  end
31
31
  end
@@ -42,7 +42,7 @@ module OpenSearch
42
42
 
43
43
  COMMON_PARAMS = [
44
44
  :ignore, # Client specific parameters
45
- :index, :type, :id, # :index/:type/:id
45
+ :index, :id, # :index/:id
46
46
  :body, # Request body
47
47
  :node_id, # Cluster
48
48
  :name, # Alias, template, settings, warmer, ...
@@ -47,22 +47,22 @@ describe 'client#bulk' do
47
47
 
48
48
  let(:body) do
49
49
  <<-PAYLOAD.gsub(/^\s+/, '')
50
- {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
50
+ {"index":{"_index":"myindexA","_id":"1"}}
51
51
  {"title":"Test"}
52
- {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
52
+ {"update":{"_index":"myindexB","_id":"2"}}
53
53
  {"doc":{"title":"Update"}}
54
- {"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
55
- {"index":{"_index":"myindexD","_type":"mytype","_id":"1"}}
54
+ {"delete":{"_index":"myindexC","_id":"3"}}
55
+ {"index":{"_index":"myindexD","_id":"1"}}
56
56
  {"data":"MYDATA"}
57
57
  PAYLOAD
58
58
  end
59
59
 
60
60
  it 'performs the request' do
61
61
  expect(client_double.bulk(:body => [
62
- { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
63
- { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
64
- { :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } },
65
- { :index => { :_index => 'myindexD', :_type => 'mytype', :_id => '1', :data => { :data => 'MYDATA' } } },
62
+ { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
63
+ { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
64
+ { :delete => { :_index => 'myindexC', :_id => '3' } },
65
+ { :index => { :_index => 'myindexD', :_id => '1', :data => { :data => 'MYDATA' } } },
66
66
  ])).to eq({})
67
67
  end
68
68
  end
@@ -80,13 +80,13 @@ describe 'client#bulk' do
80
80
 
81
81
  let(:body) do
82
82
  <<-PAYLOAD.gsub(/^\s+/, '')
83
- {"update":{"_index":"myindex","_type":"mytype","_id":"1"}}
83
+ {"update":{"_index":"myindex","_id":"1"}}
84
84
  {"doc":{"data":{"title":"Update"}}}
85
85
  PAYLOAD
86
86
  end
87
87
 
88
88
  it 'performs the request' do
89
- expect(client_double.bulk(body:[ { :update => { :_index => 'myindex', :_type => 'mytype', :_id => '1' } },
89
+ expect(client_double.bulk(body:[ { :update => { :_index => 'myindex', :_id => '1' } },
90
90
  { :doc => { :data => { :title => 'Update' } } } ])).to eq({})
91
91
  end
92
92
  end
@@ -134,15 +134,4 @@ describe 'client#bulk' do
134
134
  expect(client_double.bulk(index: 'foo^bar', body: [])).to eq({})
135
135
  end
136
136
  end
137
-
138
- context 'when the type is provided' do
139
-
140
- let(:url) do
141
- 'myindex/mytype/_bulk'
142
- end
143
-
144
- it 'performs the request' do
145
- expect(client_double.bulk(index: 'myindex', type: 'mytype', body: [])).to eq({})
146
- end
147
- end
148
137
  end
@@ -42,12 +42,12 @@ describe 'client#count' do
42
42
  expect(client_double.count).to eq({})
43
43
  end
44
44
 
45
- context 'when an index and type are specified' do
45
+ context 'when an index is specified' do
46
46
 
47
47
  let(:expected_args) do
48
48
  [
49
49
  'POST',
50
- 'foo,bar/t1,t2/_count',
50
+ 'foo,bar/_count',
51
51
  {},
52
52
  nil,
53
53
  {}
@@ -55,7 +55,7 @@ describe 'client#count' do
55
55
  end
56
56
 
57
57
  it 'performs the request' do
58
- expect(client_double.count(index: ['foo','bar'], type: ['t1','t2'])).to eq({})
58
+ expect(client_double.count(index: ['foo','bar'])).to eq({})
59
59
  end
60
60
  end
61
61
 
@@ -31,7 +31,7 @@ describe 'client#create_document' do
31
31
  let(:expected_args) do
32
32
  [
33
33
  'PUT',
34
- 'foo/bar/123',
34
+ 'foo/_doc/123',
35
35
  { op_type: 'create' },
36
36
  { foo: 'bar' },
37
37
  {}
@@ -39,7 +39,7 @@ describe 'client#create_document' do
39
39
  end
40
40
 
41
41
  it 'performs the request' do
42
- expect(client_double.create(index: 'foo', type: 'bar', id: '123', body: { foo: 'bar'})).to eq({})
42
+ expect(client_double.create(index: 'foo', id: '123', body: { foo: 'bar'})).to eq({})
43
43
  end
44
44
 
45
45
  context 'when the request needs to be URL-escaped' do
@@ -47,7 +47,7 @@ describe 'client#create_document' do
47
47
  let(:expected_args) do
48
48
  [
49
49
  'PUT',
50
- 'foo/bar%2Fbam/123',
50
+ 'foo%5Ebar/_doc/123',
51
51
  { op_type: 'create' },
52
52
  {},
53
53
  {}
@@ -55,7 +55,7 @@ describe 'client#create_document' do
55
55
  end
56
56
 
57
57
  it 'performs the request' do
58
- expect(client_double.create(index: 'foo', type: 'bar/bam', id: '123', body: {})).to eq({})
58
+ expect(client_double.create(index: 'foo^bar', id: '123', body: {})).to eq({})
59
59
  end
60
60
  end
61
61
 
@@ -64,7 +64,7 @@ describe 'client#create_document' do
64
64
  let(:expected_args) do
65
65
  [
66
66
  'PUT',
67
- 'foo/bar/1',
67
+ 'foo/_doc/1',
68
68
  { op_type: 'create' },
69
69
  { foo: 'bar' },
70
70
  {}
@@ -72,7 +72,7 @@ describe 'client#create_document' do
72
72
  end
73
73
 
74
74
  it 'updates the arguments with the `op_type`' do
75
- expect(client_double.create(index: 'foo', type: 'bar', id: 1, body: { foo: 'bar' })).to eq({})
75
+ expect(client_double.create(index: 'foo', id: 1, body: { foo: 'bar' })).to eq({})
76
76
  end
77
77
  end
78
78
 
@@ -81,7 +81,7 @@ describe 'client#create_document' do
81
81
  let(:expected_args) do
82
82
  [
83
83
  'POST',
84
- 'foo/bar',
84
+ 'foo/_doc',
85
85
  { },
86
86
  { foo: 'bar' },
87
87
  {}
@@ -89,7 +89,7 @@ describe 'client#create_document' do
89
89
  end
90
90
 
91
91
  it 'updates the arguments with the `op_type`' do
92
- expect(client_double.create(index: 'foo', type: 'bar', body: { foo: 'bar' })).to eq({})
92
+ expect(client_double.create(index: 'foo', body: { foo: 'bar' })).to eq({})
93
93
  end
94
94
  end
95
95
  end
@@ -48,23 +48,6 @@ describe 'client#delete_by_query' do
48
48
  expect(client_double.delete_by_query(index: 'foo', body: { term: {} })).to eq({})
49
49
  end
50
50
 
51
- context 'when the type argument is provided' do
52
-
53
- let(:expected_args) do
54
- [
55
- 'POST',
56
- 'foo/tweet,post/_delete_by_query',
57
- {},
58
- { term: {} },
59
- {}
60
- ]
61
- end
62
-
63
- it 'performs the request' do
64
- expect(client_double.delete_by_query(index: 'foo', type: ['tweet', 'post'], body: { term: {} })).to eq({})
65
- end
66
- end
67
-
68
51
  context 'when a query is provided' do
69
52
  let(:expected_args) do
70
53
  [
@@ -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