---
title: "search · RUAL Documentation"
description: "searches in the given storage based on a query."
canonical: https://docs.rual.nl/block-types/storage/function_search
language: en
---

# search

This block is part of the [`storage`](https://docs.rual.nl/block-types/storage) group and was last modified in core [`v13.0.4`](https://docs.rual.nl/core-versions/130004).

### Storage Selection Required

This block relies on a storage to perform its storage releated actions. You must manually select the storage you want to use in your flow using the storage selector modal. To access the modal, click the white button on the block.

searches in the given storage based on a query.

- flow `flow`

- Query required `query` choose the query you would like to run, keep them simple for speed. • Suggestions: `query_bool_must` `query_bool_must_not` `query_bool_should`

- Limit `number` Default `5000`

- Offset `number`

- Cache Key `v13.0.4` `value` You can use this option to serve cached results for frequently used and resource-intensive searches. If the data doesn't change, repeated searches with the same cache key retrieve results from the same request cache. For time series use cases, such as logging, data in older data is rarely updated and can be served directly from this cache.

- Storage `storage`

- flow `flow`

- Results `array` Array of objects, each object is a single document. All results always include `_meta`.

- hits `number` Number of documents found matching the given query.

- guids `v10.6.2` `array`

- Has hits `condition`

- Profile `array` Analyzed profile of the query, this data is gathered only when the query includes the `Profile` action.

- success `condition`

- error `value`

- cursor `array` Sort values of the last hit. Pass this to a search_after query block for cursor-based pagination.

| `database` |
| --- |

A [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the flow, a term query built with [fields](https://docs.rual.nl/block-types/query/query_bool_term_fields) and [must](https://docs.rual.nl/block-types/query/query_bool_must) feeds the query pin, and [search](https://docs.rual.nl/block-types/storage/function_search) returns the matching documents. The results array is counted with [length](https://docs.rual.nl/block-types/array/array_length) here; in API blueprints it typically goes straight to the reply.

![Studio canvas example for the search block: searching a storage with a query.](https://docs.rual.nl/canvas-examples/function_search.png)

### Commonly used with

One of the most-used blocks across production blueprints. It is most often wired together with:

- [branch](https://docs.rual.nl/block-types/flow/branch): wired in both directions with this block.

- [must](https://docs.rual.nl/block-types/query/query_bool_must): feeds into this block. All queries provided must match.

- [reply in JSON](https://docs.rual.nl/block-types/json/httpconnection_set_json): this block feeds into it. Reply to any httpconnection as JSON body.

- [create](https://docs.rual.nl/block-types/globals/trigger_custom_function): feeds into this block. Creates a new function that can be executed using the given name.

- [filter](https://docs.rual.nl/block-types/query/query_bool_filter): feeds into this block. Build a custom query using higher-level bool query.

- [multiple](https://docs.rual.nl/block-types/query/query_and): feeds into this block.

### Used in these guides

These documentation pages use or explain this block:

- [Block Quick Reference](https://docs.rual.nl/reference/block-quick-reference)

### Version history

Introduced in [`v13.0.4`](https://docs.rual.nl/core-versions/130004).
