Module: Elasticsearch::Persistence::Repository::Find
- Included in:
- Elasticsearch::Persistence::Repository
- Defined in:
- lib/elasticsearch/persistence/repository/find.rb
Overview
Retrieves one or more domain objects from the repository
Instance Method Summary collapse
-
#exists?(id, options = {}) ⇒ true, false
Return if object exists in the repository.
-
#find(*args) ⇒ Object, Array
Retrieve a single object or multiple objects from Elasticsearch by ID or IDs.
Instance Method Details
#exists?(id, options = {}) ⇒ true, false
Return if object exists in the repository
65 66 67 68 |
# File 'lib/elasticsearch/persistence/repository/find.rb', line 65 def exists?(id, ={}) request = { index: index_name, id: id } client.exists(request.merge()) end |
#find(*args) ⇒ Object, Array
Retrieve a single object or multiple objects from Elasticsearch by ID or IDs
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/elasticsearch/persistence/repository/find.rb', line 41 def find(*args) = args.last.is_a?(Hash) ? args.pop : {} ids = args if args.size == 1 id = args.pop id.is_a?(Array) ? __find_many(id, ) : __find_one(id, ) else __find_many args, end end |