Module: Elastify::ActiveRecordExtensions::ClassMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/elastify/active_record_extensions.rb
Instance Method Summary collapse
- #elastify_scroll(scroll_id: nil, scroll_timer: "1m") ⇒ Object
- #elastify_search(dsl: nil, scroll_timer: "1m") ⇒ Object
- #elastify_setup {|config| ... } ⇒ Object
Instance Method Details
#elastify_scroll(scroll_id: nil, scroll_timer: "1m") ⇒ Object
31 32 33 |
# File 'lib/elastify/active_record_extensions.rb', line 31 def elastify_scroll(scroll_id: nil, scroll_timer: "1m") return Elastify::Helpers::ElasticSearch::Document.new(self.).scroll(scroll_id, scroll_timer) end |
#elastify_search(dsl: nil, scroll_timer: "1m") ⇒ Object
27 28 29 |
# File 'lib/elastify/active_record_extensions.rb', line 27 def elastify_search(dsl: nil, scroll_timer: "1m") return Elastify::Helpers::ElasticSearch::Document.new(self.).search(dsl, scroll_timer) end |
#elastify_setup {|config| ... } ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/elastify/active_record_extensions.rb', line 11 def elastify_setup(&block) include Elastify::ActiveRecordExtensions::LocalMethods cattr_accessor :elastify_options attr_accessor :elastify_serialized_document config = Elastify::Configurators::Model.new yield(config) if block_given? self. = {} if self..blank? self.[:base_url] = Elastify.configs[:base_url] self.[:index] = config.opt_index if config.opt_index.present? self.[:type] = config.opt_type if config.opt_type.present? self.[:map] = config.opt_mapping if config.opt_mapping.present? self.[:decode] = config.opt_decode if config.opt_decode.present? self.[:encode] = config.opt_encode if config.opt_encode.present? end |