document/search FormID 20307
Full Elasticsearch Query DSL search. Supports bool, multi_match, range, term, sorting, pagination, aggregations, and every other query type the Elasticsearch Search API accepts. Returns matching documents, total hit count, and aggregation results.
When to Use
- Full-text search: A user submits a search term — use
multi_matchto search across title, description, and tags simultaneously with relevance scoring. - Complex filtering: Combine must/should/must_not clauses in a
boolquery to filter by category, price range, availability, and region in a single operation. - Aggregations and analytics: Compute bucket aggregations (terms, date_histogram) or metric aggregations (avg, sum, percentiles) to power dashboards and reports — the aggregation result is returned alongside the document list.
- Relevance-scored results: Retrieve results ordered by Elasticsearch relevance score for search-as-you-type, product search, or log analysis use cases.
- Range queries: Find orders placed in the last 7 days, products priced between two values, or log entries at WARNING level or above using
rangeandtermclauses.
document/get or document/getMany. Those are faster because they bypass the query engine entirely. Use document/search when you need relevance scoring, aggregations, or multi-clause filtering.
Configuration
Connection
| Field | Required | Description |
|---|---|---|
Host | Required | Elasticsearch cluster URL, e.g. https://localhost:9200. |
Username | Optional | Elasticsearch username (required if security is enabled). |
Password | Optional | Password for the specified username. |
IgnoreSSL | Optional | Default false. Skip TLS validation. Development use only. |
Operation
| Field | Required | Description |
|---|---|---|
IndexName | Required | The index to search. |
Query | Required | A valid Elasticsearch Query DSL object. This is the query clause passed directly to the Elasticsearch Search API. Any query type is supported: match, bool, multi_match, term, range, match_all, etc. |
Limit | Optional | Maximum number of documents to return. Default 50. Ignored when ReturnAll is true. |
ReturnAll | Optional | Default false. When true, automatically pages through all matching documents and returns the complete result set. |
Simplify | Optional | Default true. When true, each document in documents contains only the _source fields. When false, the full Elasticsearch hit metadata (_id, _score, _index) is included alongside _source in every document entry. |
Aggregations | Optional | An Elasticsearch aggregations object. Passed directly as the aggs clause. Results are returned in the aggregations output field. Optional — omit if you only need documents. |
Validation Errors
| Error Code | Cause |
|---|---|
VAL_MISSING_INDEX | IndexName is empty. |
VAL_MISSING_QUERY | Query is null or empty. A Query DSL object is required for every search operation. |
Output
Success Port
| Field | Type | Description |
|---|---|---|
documents | array | Matched documents. When Simplify is true (default), each entry contains only the document fields. When false, each entry includes _id, _score, _index, and _source. |
totalHits | integer | Total number of documents matching the query in the index. May exceed documents.length when Limit is applied. |
aggregations | object | Aggregation results keyed by aggregation name. Empty object {} when no aggregations were requested. |
status | string | "success" |
Error Port
Fires on query parse errors, connection failures, authentication errors, or if the index does not exist. The error output contains errorCode and message fields.
Examples
Full-Text Product Search
{
"resource": "document",
"operation": "search",
"IndexName": "products",
"Query": {
"multi_match": {
"query": "{{ $json.searchTerm }}",
"fields": ["title^3", "description", "tags"],
"type": "best_fields"
}
},
"Limit": 20
}
Searches across title (boosted 3×), description, and tags. Access results with {{ $output.searchProducts.documents }}.
Bool Query — Filtered Orders
{
"resource": "document",
"operation": "search",
"IndexName": "orders",
"Query": {
"bool": {
"must": [
{ "term": { "status": "pending" } }
],
"filter": [
{ "range": { "createdAt": { "gte": "now-7d/d" } } },
{ "term": { "region": "{{ $json.region }}" } }
]
}
},
"Limit": 50
}
Retrieves pending orders from the past 7 days in the specified region.
Search with Aggregations — Sales by Category
{
"resource": "document",
"operation": "search",
"IndexName": "orders",
"Query": {
"range": {
"createdAt": { "gte": "now-30d/d" }
}
},
"Aggregations": {
"sales_by_category": {
"terms": { "field": "category.keyword", "size": 10 }
},
"total_revenue": {
"sum": { "field": "amount" }
}
},
"Limit": 0
}
Setting Limit: 0 returns only aggregations with no document data. Access results with {{ $output.salesReport.aggregations.sales_by_category.buckets }}.
Score Metadata — Disable Simplify
{
"resource": "document",
"operation": "search",
"IndexName": "articles",
"Query": {
"match": { "body": "{{ $json.query }}" }
},
"Simplify": false,
"Limit": 10
}
With Simplify: false, each document entry includes _id, _score, _index, and _source. Use _score to rank or threshold results downstream.