Method: ElasticsearchRecord::ModelApi#index

Defined in:
lib/elasticsearch_record/model_api.rb

#index(data, **options) ⇒ Object

fast insert/update data. IMPORTANT: Any 'doc'-id must by provided with underscore '_' ( +:_id+ )

Examples:

index([{name: 'Hans', age: 34}, {name: 'Peter', age: 22}])

index({_id: 5, name: 'Georg', age: 87})

Parameters:

  • data (Array<Hash>, Hash)
  • options (Hash)


209
210
211
# File 'lib/elasticsearch_record/model_api.rb', line 209

def index(data, **options)
  bulk(data, :index, **options)
end