Elasticsearch
App · Databases · 4 actions
Create, read, update, and delete documents in your Elasticsearch indices.
Actions
| Action | What it does |
|---|---|
| Create document | Add a new document to an index. |
| Delete document | Delete a document from an index by its Document ID. |
| Get document | Retrieve a single document from an index by its Document ID. |
| Update document | Update a document by its Document ID. |
Create document
Add a new document to an index. Provide a Document ID to control the id (the action fails if that id already exists; use Update document to change an existing one), or leave it blank to let Elasticsearch generate one.
Inputs
- Index
indextextRequired - Name of the index to add the document to (for example 'products'). Elasticsearch creates the index automatically if it does not exist yet.
- Document
documentobjectRequired - The document to store, as field/value pairs (for example, name: 'Wireless Headphones', price: 79.99).
- Document ID
document_idtext - Optional unique id for the new document. When blank, Elasticsearch generates one and returns it.
Outputs
document_idtext- Id of the created document
indextext- Index the document was written to
resulttext- Elasticsearch write result, e.g. 'created'
versionnumber- Document version assigned by Elasticsearch
Example output
{
"document_id": "1",
"index": "products",
"result": "created",
"version": 1
}Delete document
Delete a document from an index by its Document ID.
Inputs
- Index
indextextRequired - The index the document lives in.
- Document ID
document_idtextRequired - The document's unique id within the index.
Outputs
document_idtext- Id of the deleted document
indextext- Index the document was deleted from
resulttext- Elasticsearch result, e.g. 'deleted'
Example output
{
"document_id": "1",
"index": "products",
"result": "deleted"
}Get document
Retrieve a single document from an index by its Document ID.
Inputs
- Index
indextextRequired - The index the document lives in.
- Document ID
document_idtextRequired - The document's unique id within the index.
Outputs
documentobject- The document's stored fields (its _source)
document_idtext- Id of the document
indextext- Index the document belongs to
versionnumber- Current document version
Example output
{
"document": {
"name": "Wireless Headphones",
"price": 79.99
},
"document_id": "1",
"index": "products",
"version": 1
}Update document
Update a document by its Document ID. The fields you provide are merged into the stored document, leaving its other fields unchanged.
Inputs
- Index
indextextRequired - Name of the index the document lives in (for example 'products'). With 'Create if missing' on, a new index is created automatically if it does not exist yet.
- Document ID
document_idtextRequired - The document's unique id within the index.
- Fields to update
documentobjectRequired - The fields to add or change, as field/value pairs (for example, price: 69.99). Fields you omit are left as they are.
- Create if missing
upserttrue/false - When on, a document that does not exist yet is created from these fields instead of failing.Default:
false.
Outputs
document_idtext- Id of the updated document
indextext- Index the document belongs to
resulttext- Elasticsearch write result, e.g. 'updated' or 'noop' when the fields already matched
versionnumber- Document version after the update
Example output
{
"document_id": "1",
"index": "products",
"result": "updated",
"version": 2
}