Class: Noiseless::Adapters::IndicesAPI
- Inherits:
-
Object
- Object
- Noiseless::Adapters::IndicesAPI
- Defined in:
- lib/noiseless/adapters/indices_api.rb
Overview
Indices API - needed for index management operations
Direct Known Subclasses
Instance Method Summary collapse
- #get(index:) ⇒ Object
-
#initialize(adapter) ⇒ IndicesAPI
constructor
A new instance of IndicesAPI.
- #refresh(index:) ⇒ Object
- #stats(index:) ⇒ Object
Constructor Details
#initialize(adapter) ⇒ IndicesAPI
Returns a new instance of IndicesAPI.
7 8 9 |
# File 'lib/noiseless/adapters/indices_api.rb', line 7 def initialize(adapter) @adapter = adapter end |
Instance Method Details
#get(index:) ⇒ Object
11 12 13 |
# File 'lib/noiseless/adapters/indices_api.rb', line 11 def get(index:) @adapter.execute_index_exists?(index) ? { index => {} } : raise("Index not found") end |
#refresh(index:) ⇒ Object
20 21 22 23 |
# File 'lib/noiseless/adapters/indices_api.rb', line 20 def refresh(index:) # Refresh the index to make documents immediately searchable @adapter.send(:execute_refresh_index, index) end |
#stats(index:) ⇒ Object
15 16 17 18 |
# File 'lib/noiseless/adapters/indices_api.rb', line 15 def stats(index:) # Return basic stats structure { "indices" => { index => {} } } end |