Module: CommonIndexer::Base
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/common_indexer/base.rb
Instance Method Summary collapse
- #delete_document ⇒ Object
-
#to_common_index ⇒ Object
Override to_common_index in the including model and return a hash of common index attributes.
- #update_common_index ⇒ Object
Instance Method Details
#delete_document ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/common_indexer/base.rb', line 18 def delete_document CommonIndexer.client.delete index: CommonIndexer.index_name, id: id, type: '_doc' rescue Elasticsearch::Transport::Transport::Error => err Rails.logger.warn("Common Index delete failure: #{err.}") end |
#to_common_index ⇒ Object
Override to_common_index in the including model and return a hash of common index attributes
14 15 16 |
# File 'lib/common_indexer/base.rb', line 14 def to_common_index raise CommonIndexer::Error, "Index Error: #{self.class.name} does not implement #to_common_index!" end |
#update_common_index ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/common_indexer/base.rb', line 26 def update_common_index CommonIndexer.client.index index: CommonIndexer.index_name, id: id, type: '_doc', body: to_common_index rescue Elasticsearch::Transport::Transport::Error => err Rails.logger.warn("Common Indexing failure: #{err.}") end |