Skip to content

Commit f965acc

Browse files
NoharaMasatopicandocodigo
authored andcommitted
[elastic#966] Adds alias for Elasticsearch::Model::Response::Results#records
By @NoharaMasato in elastic#976
1 parent 6a0b594 commit f965acc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

elasticsearch-model/lib/elasticsearch/model/response/results.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def results
4242
response.response['hits']['hits'].map { |hit| Result.new(hit) }
4343
end
4444

45+
alias records results
4546
end
4647
end
4748
end

elasticsearch-model/spec/elasticsearch/model/response/results_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def self.document_type; 'bar'; end
4848
response.results
4949
end
5050

51+
let(:records) do
52+
response.records
53+
end
54+
5155
describe '#results' do
5256

5357
it 'provides access to the results' do
@@ -70,4 +74,12 @@ def self.document_type; 'bar'; end
7074
expect(response.raw_response).to eq(response_document)
7175
end
7276
end
77+
78+
describe '#records' do
79+
80+
it 'provides access to the records' do
81+
expect(results.records.size).to be(results.results.size)
82+
expect(results.records.first.foo).to eq(results.results.first.foo)
83+
end
84+
end
7385
end

0 commit comments

Comments
 (0)