lib/elastic_mapper/index.rb in elastic_mapper-0.1.0 vs lib/elastic_mapper/index.rb in elastic_mapper-0.2.1
- old
+ new
@@ -7,9 +7,16 @@
mapping_name = self.class.instance_variable_get(:@_mapping_name)
ElasticMapper.index.type(mapping_name).put(self.id, index_hash)
end
+ # Remove the document from the ElasticSearch index.
+ def delete_from_index
+ mapping_name = self.class.instance_variable_get(:@_mapping_name)
+
+ ElasticMapper.index.type(mapping_name).delete(self.id)
+ end
+
# Generate a hash representation of the model.
#
# @return [Hash] hash representation of model.
def index_hash
mapping = self.class.instance_variable_get(:@_mapping)