class ElasticRecord::SearchHits
Attributes
hits[RW]
model[RW]
total[RW]
Public Class Methods
from_response(response)
click to toggle source
# File lib/elastic_record/search_hits.rb, line 6 def from_response(response) new(response['hits']['hits'], total: response['hits']['total']) end
new(hits, total: nil)
click to toggle source
# File lib/elastic_record/search_hits.rb, line 11 def initialize(hits, total: nil) @hits = hits @total = total.is_a?(Hash) ? total['value'] : total end
Public Instance Methods
to_ids()
click to toggle source
# File lib/elastic_record/search_hits.rb, line 16 def to_ids hits.map { |hit| hit['_id'] } end