class Stretcher::SearchResults
Conveniently represents elastic search results in a more compact fashion
Available properties:
-
raw : The raw response from elastic search
-
total : The total number of matched docs
-
facets : the facets hash
-
results : The hit results with _id merged in to _source
Public Instance Methods
documents()
click to toggle source
Returns a 'prettier' version of elasticsearch results Also aliased as docs
This will:
-
Return either '_source' or 'fields' as the base of the result
-
Merge any keys beginning with a '_' into it as well (such as '_score')
-
Copy the 'highlight' field into '_highlight'
# File lib/em/stretcher/search_results.rb, line 20 def documents raw_plain.bind! do |result| result.hits.hits.map do |hit| doc = extract_source(hit) copy_underscores(hit, doc) copy_highlight(hit, doc) doc end end end
Also aliased as: docs