Method: Elasticsearch::Model::Indexing::InstanceMethods#index_document
- Defined in:
- lib/elasticsearch/model/indexing.rb
permalink #index_document(options = {}) ⇒ Hash
Serializes the model instance into JSON (by calling ‘as_indexed_json`), and saves the document into the Elasticsearch index.
361 362 363 364 365 366 367 368 |
# File 'lib/elasticsearch/model/indexing.rb', line 361 def index_document(={}) document = as_indexed_json request = { index: index_name, id: id, body: document } client.index(request.merge!()) end |