Skip to content

Commit

Permalink
Remove _type from everything
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Sep 29, 2022
1 parent 3b2f949 commit 4b73ec0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
8 changes: 4 additions & 4 deletions opensearch-api/lib/opensearch/api/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ def __pathify(*segments)
# in a single item.
#
# OpenSearch::API::Utils.__bulkify [
# { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
# { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
# { :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
# { :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } }
# ]
#
# # => {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
# # => {"index":{"_index":"myindexA","_id":"1"}}
# # => {"title":"Test"}
# # => {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
# # => {"update":{"_index":"myindexB","_id":"2"}}
# # => {"doc":{"title":"Update"}}
#
def __bulkify(payload)
Expand Down
2 changes: 0 additions & 2 deletions opensearch-api/spec/opensearch/api/actions/hashie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"hits": [
{
"_index": "myindex",
"_type": "mytype",
"_id": "1",
"_score": 0.51104903,
"_source": {
Expand All @@ -63,7 +62,6 @@
},
"facets": {
"tags": {
"_type": "terms",
"missing": 0,
"total": 10,
"other": 0,
Expand Down
12 changes: 6 additions & 6 deletions opensearch-api/spec/opensearch/api/utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@

let(:result) do
utils.__bulkify [
{ :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
{ :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
{ :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } }
{ :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
{ :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
{ :delete => { :_index => 'myindexC', :_id => '3' } }
]
end

let(:expected_string) do
<<-PAYLOAD.gsub(/^\s+/, '')
{"index":{"_index":"myindexA","_type":"mytype","_id":"1"}}
{"index":{"_index":"myindexA","_id":"1"}}
{"title":"Test"}
{"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
{"update":{"_index":"myindexB","_id":"2"}}
{"doc":{"title":"Update"}}
{"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
{"delete":{"_index":"myindexC","mytypeC","_id":"3"}}
PAYLOAD
end

Expand Down
2 changes: 1 addition & 1 deletion profile/benchmarking/measurable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def client
def dataset_slices(slice_size=10000)
@dataset_slices ||= begin
dataset.collect do |d|
{ index: { _index: INDEX, _type: '_doc', data: d } }
{ index: { _index: INDEX, data: d } }
end.each_slice(slice_size)
end
end
Expand Down

0 comments on commit 4b73ec0

Please sign in to comment.