Class: Elasticated::Repository
- Inherits:
-
Object
- Object
- Elasticated::Repository
- Defined in:
- lib/elasticated/repository.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
child can implement ‘execute(action, query, opts)’ child can implement ‘prepare(action, document, opts)’.
Instance Method Summary collapse
- #delete_by(query, opts = {}) ⇒ Object
- #execute_aggregated_search(query, opts = {}) ⇒ Object
- #execute_aggregations(query, opts = {}) ⇒ Object
- #execute_count(query, opts = {}) ⇒ Object
- #execute_search(query, opts = {}) ⇒ Object
- #exists?(query, opts = {}) ⇒ Boolean
- #index_document(document, opts = {}) ⇒ Object
-
#initialize(opts = {}) ⇒ Repository
constructor
A new instance of Repository.
- #update_document(document, opts = {}) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Repository
Returns a new instance of Repository.
9 10 11 |
# File 'lib/elasticated/repository.rb', line 9 def initialize(opts={}) self.client = Client.new opts end |
Instance Attribute Details
#client ⇒ Object
child can implement ‘execute(action, query, opts)’ child can implement ‘prepare(action, document, opts)’
7 8 9 |
# File 'lib/elasticated/repository.rb', line 7 def client @client end |
Instance Method Details
#delete_by(query, opts = {}) ⇒ Object
29 30 31 |
# File 'lib/elasticated/repository.rb', line 29 def delete_by(query, opts={}) execute :delete, query, opts end |
#execute_aggregated_search(query, opts = {}) ⇒ Object
25 26 27 |
# File 'lib/elasticated/repository.rb', line 25 def execute_aggregated_search(query, opts={}) execute :aggregated_search, query, opts end |
#execute_aggregations(query, opts = {}) ⇒ Object
17 18 19 |
# File 'lib/elasticated/repository.rb', line 17 def execute_aggregations(query, opts={}) execute :aggregations, query, opts end |
#execute_count(query, opts = {}) ⇒ Object
21 22 23 |
# File 'lib/elasticated/repository.rb', line 21 def execute_count(query, opts={}) execute :count, query, opts end |
#execute_search(query, opts = {}) ⇒ Object
13 14 15 |
# File 'lib/elasticated/repository.rb', line 13 def execute_search(query, opts={}) execute :search, query, opts end |
#exists?(query, opts = {}) ⇒ Boolean
33 34 35 |
# File 'lib/elasticated/repository.rb', line 33 def exists?(query, opts={}) execute_count(query, opts) > 0 end |
#index_document(document, opts = {}) ⇒ Object
37 38 39 |
# File 'lib/elasticated/repository.rb', line 37 def index_document(document, opts={}) prepare :index, document, opts end |
#update_document(document, opts = {}) ⇒ Object
41 42 43 |
# File 'lib/elasticated/repository.rb', line 41 def update_document(document, opts={}) prepare :update, document, opts end |