Method: Elasticsearch::Model::Indexing::InstanceMethods#delete_document

Defined in:
lib/elasticsearch/model/indexing.rb

#delete_document(options = {}) ⇒ Hash

Deletes the model instance from the index

Examples:

Delete a record


@article.__elasticsearch__.delete_document
2013-11-20 16:27:00 +0100: DELETE http://localhost:9200/articles/article/1

Parameters:

  • options (Hash) (defaults to: {})

    Optional arguments for passing to the client

Returns:

  • (Hash)

    The response from Elasticsearch

See Also:

[View source]

383
384
385
386
387
388
# File 'lib/elasticsearch/model/indexing.rb', line 383

def delete_document(options={})
  request = { index: index_name,
              id:    self.id }

  client.delete(request.merge!(options))
end