Module: Eson::More::Extract

Defined in:
lib/eson/more/extract.rb

Instance Method Summary collapse

Instance Method Details

#extract_hits(response) ⇒ Object

Extracts doc hits as hashes from a search result.

Parameters:

  • response (Hash)

    the response body as returned by a search request.



14
15
16
# File 'lib/eson/more/extract.rb', line 14

def extract_hits(response)
  response["hits"]["hits"]
end

#extract_sources(response) ⇒ Object

Extracts doc sources as hashes from a search result.

Parameters:

  • response (Hash)

    the response body as returned by a search request.



7
8
9
# File 'lib/eson/more/extract.rb', line 7

def extract_sources(response)
  extract_hits(response).map {|h| h["_source"] }
end