Elasticsearch

App · Databases · 5 actions

Create, read, update, search and delete documents in your Elasticsearch indices, and start a workflow when a document is added.

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.
Search documentsFind documents in an index by words they contain, by the value of one field, or both, such as every order whose status is pending.
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
}

Search documents

Find documents in an index by words they contain, by the value of one field, or both, such as every order whose status is pending. Leave both empty to list the index's documents. Returns up to 100, sorted by a field you choose or by how well they match.

Inputs

IndexindextextRequired
The index the document lives in.
Search forsearch_texttext
Words to look for anywhere in the documents, such as wireless headphones. Every word must appear. Leave it empty to match on a field alone, or to list documents.
Fieldfieldtext
Only documents whose value in this field matches Value, such as status. Use dots for a field inside another, such as customer.email.
Valuevaluetext
The value Field must have, such as pending. Needed when Field is filled in.
Sort bysort_bytext
A field to put the documents in order by, such as created_at or price. Leave it empty to put the best matches first.
Ordersort_ordertext
Which end of Sort by comes first.One of: desc (Highest or newest first), asc (Lowest or oldest first). Default: desc.
Limitlimitnumber
The most documents to return, from 1 to 100.Default: 10.

Outputs

countnumber
How many documents were returned
documentslist
The documents found, each with its index, document_id, score (how well it matched) and document (its stored fields)
indextext
The index that was searched
totalnumber
How many documents match in all, which can be more than were returned
Example output
{
  "count": 1,
  "documents": [
    {
      "document": {
        "name": "Wireless Headphones",
        "price": 79.99
      },
      "document_id": "1",
      "index": "products",
      "score": 1.3862942
    }
  ],
  "index": "products",
  "total": 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