Module: Elastics::ActiveRecord::HelperMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/elastics/active_record/helper_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#delete_elasticsObject



92
93
94
95
# File 'lib/elastics/active_record/helper_methods.rb', line 92

def delete_elastics
  self.class.request_elastics(method: :delete, id: id)
rescue NotFound
end

#index_elasticsObject



80
81
82
# File 'lib/elastics/active_record/helper_methods.rb', line 80

def index_elastics
  self.class.request_elastics(method: :post, id: id, body: to_elastics)
end

#update_elastics(data) ⇒ Object



84
85
86
# File 'lib/elastics/active_record/helper_methods.rb', line 84

def update_elastics(data)
  self.class.request_elastics(method: :post, id: "#{id}/_update", body: data)
end

#update_elastics_doc(fields) ⇒ Object



88
89
90
# File 'lib/elastics/active_record/helper_methods.rb', line 88

def update_elastics_doc(fields)
  update_elastics(doc: fields)
end