IMPORTANT: elasticsearch.js has been replaced by the new Elasticsearch JavaScript client. We strongly advise you to migrate to the new client. To learn more, see the migration guide.
create
editcreate
editclient.create([params, [callback]])
Adds a typed JSON document in a specific index, making it searchable. If a document with the same index
, type
, and id
already exists, an error will occur.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Create a document.
await client.create({ index: 'myindex', type: 'mytype', id: '1', body: { title: 'Test 1', tags: ['y', 'z'], published: true, published_at: '2013-01-01', counter: 1 } });
Params
|
|
|
|
|
|
|
|
|
|
|
Timestamp — Explicit timestamp for the document |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|