Elasticsearch

App · Databases · 4 actions

Create, read, update, and delete documents in your Elasticsearch indices.

Actions

ActionWhat it does
Create documentAdd a new document to an index.
Delete documentDelete a document from an index by its Document ID.
Get documentRetrieve a single document from an index by its Document ID.
Update documentUpdate 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

IndexindextextRequired
Name of the index to add the document to (for example 'products'). Elasticsearch creates the index automatically if it does not exist yet.
DocumentdocumentobjectRequired
The document to store, as field/value pairs (for example, name: 'Wireless Headphones', price: 79.99).
Document IDdocument_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

IndexindextextRequired
The index the document lives in.
Document IDdocument_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

IndexindextextRequired
The index the document lives in.
Document IDdocument_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

IndexindextextRequired
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 IDdocument_idtextRequired
The document's unique id within the index.
Fields to updatedocumentobjectRequired
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 missingupserttrue/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
}

On this page