Method: SearchFlip::Index::ClassMethods#get

Defined in:
lib/search_flip/index.rb

#get(id, params = {}) ⇒ Hash

Retrieves the document specified by id from Elasticsearch. Raises SearchFlip::ResponseError specific exceptions in case any errors occur.

Examples:

UserIndex.get(1)
UserIndex.get(1, routing: "key")

Parameters:

  • id (String, Fixnum)

    The id to get

  • params (Hash) (defaults to: {})

    Optional params for the request

Returns:

  • (Hash)

    The specified document



457
458
459
# File 'lib/search_flip/index.rb', line 457

def get(id, params = {})
  connection.http_client.headers(accept: "application/json").get("#{type_url}/#{id}", params: params).parse
end