Class: Esearch::Presenter::Hit

Inherits:
Esearch::Presenter show all
Defined in:
lib/esearch/presenter/hit.rb

Overview

Presenter for an hit

Instance Method Summary collapse

Instance Method Details

#_idString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return id

Returns:

  • (String)


57
# File 'lib/esearch/presenter/hit.rb', line 57

expose_primitive(:_id, :id)

#_indexString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return index name

Returns:

  • (String)


41
# File 'lib/esearch/presenter/hit.rb', line 41

expose_primitive(:_index, :index_name)

#_scoreFloat

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return score

Returns:

  • (Float)


65
# File 'lib/esearch/presenter/hit.rb', line 65

expose_primitive(:_score, :score)

#_typeType

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return type name

Returns:



49
# File 'lib/esearch/presenter/hit.rb', line 49

expose_primitive(:_type, :type_name)

#fieldsHash?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return fields if present

Returns:

  • (Hash)

    if present

  • (nil)

    otherwise



31
32
33
# File 'lib/esearch/presenter/hit.rb', line 31

def fields
  raw['fields']
end

#sourceHash?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return source field if present

Returns:

  • (Hash)

    if present

  • (nil)

    otherwise



17
18
19
# File 'lib/esearch/presenter/hit.rb', line 17

def source
  raw['_source']
end