OpenSearch icon

OpenSearch

Consume the OpenSearch API

Actions9

Overview

This node interacts with the OpenSearch API to perform operations on documents within an OpenSearch index. Specifically, for the Document - Get operation, it retrieves a single document by its ID from a specified index. This is useful when you need to fetch detailed information about a specific record stored in OpenSearch.

Common scenarios include:

  • Retrieving user profiles, product details, or logs stored as documents in OpenSearch.
  • Fetching data for display or further processing in workflows.
  • Accessing specific documents for validation or auditing purposes.

Example: You have an index of customer orders and want to retrieve the order details for a particular order ID.

Properties

Name Meaning
Index ID The identifier of the OpenSearch index containing the document to retrieve.
Document ID The unique identifier of the document to retrieve from the specified index.
Simplify Whether to return a simplified version of the response (only the document ID and source fields) or the full raw response from OpenSearch. Defaults to true.
Options Additional options to customize the retrieval:
  Source Excludes Comma-separated list of source fields to exclude from the returned document.
  Source Includes Comma-separated list of source fields to include in the returned document.
  Stored Fields Boolean flag indicating whether to retrieve stored fields instead of the document’s _source. Defaults to false.

Output

The output JSON contains the retrieved document data:

  • If Simplify is enabled (default), the output includes:

    • _id: The document ID.
    • All fields from the document's _source merged at the top level.
  • If Simplify is disabled, the output returns the full raw response from OpenSearch, which includes metadata such as _index, _type, _version, and the full _source object.

No binary data is output by this operation.

Dependencies

  • Requires an active connection to an OpenSearch instance.
  • Needs an API key or authentication token configured in n8n credentials to authorize requests to the OpenSearch API.
  • The node uses internal helper functions to make HTTP requests to OpenSearch endpoints.

Troubleshooting

  • Error: Document not found
    Occurs if the specified Index ID or Document ID does not exist. Verify that both IDs are correct and that the document exists in the index.

  • Invalid JSON in 'Query' option
    If using advanced query options (not typical for Get operation), ensure any JSON input is correctly formatted.

  • Authentication errors
    Ensure the API key or authentication credentials are valid and have sufficient permissions to access the index and documents.

  • Network or connectivity issues
    Confirm that the OpenSearch endpoint is reachable from the n8n environment.

If the node throws an error with a message and description, check the item index indicated to identify which input caused the failure. Use "Continue On Fail" mode to process other items even if some fail.

Links and References

Discussion