Couchbase icon

Couchbase

Couchbase node to insert, update, retrieve, and delete data from a Couchbase database using KV, Query and Search services

Actions7

Overview

This node enables performing full-text search queries on a Couchbase database using its Search service. It is designed to retrieve documents matching specified search criteria from a given Couchbase search index. The node supports both a simplified mode, where users provide a textual search query and configure common options, and an advanced mode, where users can input a raw JSON search query for more complex or customized searches.

Typical use cases include:

  • Searching documents in a Couchbase bucket by keywords or phrases.
  • Retrieving specific fields from matched documents.
  • Limiting the number of search results returned.
  • Including term location information in results for highlighting or analysis.
  • Using advanced JSON queries to leverage the full power of Couchbase's search capabilities.

For example, a user might want to find all travel-related documents containing the word "hotel" in a specific index, returning only the name and address fields, limited to 10 results.

Properties

Name Meaning
Search Type Type of search to perform. Currently supports "Couchbase Search Full Text".
Advanced Mode Whether to use advanced mode to provide a raw JSON search query instead of a simple text query.
Index Name The full name of the Couchbase search index to query (format: bucket.scope.indexName).
Search Query The full-text search query string to execute (used when Advanced Mode is false).
Fields to Return Comma-separated list of document fields to return in the search results; * returns all fields; empty means no fields.
Limit Maximum number of search results to return.
Include Locations Whether to include term location data in the search results (useful for highlighting matched terms).
Raw Search Query A raw JSON object representing the search query (used when Advanced Mode is true).

Output

The node outputs an array of JSON objects representing the search results. Each result corresponds to a matched document or search hit with fields filtered according to the Fields to Return property.

  • When using simple mode, each result contains the requested fields and optionally term location data if enabled.
  • When using advanced mode, the output reflects the structure of the raw search query response, but filtered to remove undefined or empty objects.
  • If no results are found, the output will contain a single object with a message indicating "No results found".

The output does not include binary data.

Dependencies

  • Requires a valid connection to a Couchbase cluster with appropriate credentials (connection string, username, password).
  • The Couchbase SDK (couchbase npm package) is used internally to connect and perform search queries.
  • The node expects a configured Couchbase search index accessible via the provided index name.
  • An API key credential or similar authentication token must be configured in n8n to allow connecting to the Couchbase cluster.

Troubleshooting

  • Connection errors: If the node cannot connect to the Couchbase cluster, verify that the connection string, username, and password are correct, and that the Couchbase server is running and reachable.
  • Bucket/Scope/Index not found: Ensure the specified bucket, scope, and search index exist in the Couchbase cluster.
  • Invalid search query: In advanced mode, malformed JSON or invalid search query syntax may cause errors. Validate the JSON format and consult Couchbase documentation for correct query structure.
  • Empty results: If no documents match the search criteria, the node returns a message indicating no results found. Adjust the search query or index configuration as needed.
  • Limit too low: Setting the results limit too low may omit relevant results; increase the limit if necessary.

Common error messages are wrapped and presented as node operation errors with descriptive messages to guide troubleshooting.

Links and References

Discussion