Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/command-reference/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,18 @@ sidebar_position: 0
| | <span class="command">JSON.STRLEN</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">JSON.TOGGLE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">JSON.TYPE</span> | <span class="support supported">Fully supported</span> |
| <span class="family">Search</span> | <span class="command">FT.CREATE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SEARCH</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNUPDATE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNDUMP</span> | <span class="support supported">Fully supported</span> |
| <span class="family">Search</span> | <span class="command">FT.CREATE</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.SEARCH</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.ALTER</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.DROPINDEX</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.INFO</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT._LIST</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.PROFILE</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.AGGREGATE</span> | <span class="support partial">Partially supported</span> |
| | <span class="command">FT.TAGVALS</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNUPDATE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.SYNDUMP</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">FT.CONFIG</span> | <span class="support supported">Fully supported</span> |
| <span class="family">Auto Suggest</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">T-Digest</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">Time Series</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
Expand Down
2 changes: 1 addition & 1 deletion docs/command-reference/search/ft._list.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ dragonfly> FT._LIST

## Related topics

- [RediSearch](https://redis.io/docs/stack/search)
- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)
135 changes: 135 additions & 0 deletions docs/command-reference/search/ft.aggregate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
description: Runs a search query and performs aggregate transformations
---

# FT.AGGREGATE

## Syntax

FT.AGGREGATE index query
[LOAD count field [field ...]]
[GROUPBY nargs property [property ...] [REDUCE function nargs arg [arg ...]] [REDUCE function nargs arg [arg ...]]]
[SORTBY nargs property [ASC|DESC] [property [ASC|DESC] ...] [MAX num]]
[LIMIT offset num]
[PARAMS nargs name value [name value ...]]

**Time complexity:** O(N)

## Description

Run a search query and perform aggregate transformations on the results.

This command provides aggregation functionality similar to SQL `GROUP BY` operations, allowing you to group search results and apply reduction functions.

## Required arguments

<details open>
<summary><code>index</code></summary>

is index name. You must first create the index using [`FT.CREATE`](./ft.create.md).
</details>

<details open>
<summary><code>query</code></summary>

is text query to search. If it's more than a single word, put it in quotes.
Refer to [query syntax](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/) for more details.
</details>

## Optional arguments

<details open>
<summary><code>LOAD count field [field ...]</code></summary>

loads additional fields from the document that are not part of the index.

`count` is the number of fields to load.
`field` is the field name to load from the document.
</details>

<details open>
<summary><code>GROUPBY nargs property [property ...] [REDUCE ...]</code></summary>

groups the results according to one or more properties.

`nargs` is the number of properties to group by.
`property` is the property name to group by.

Optionally followed by one or more `REDUCE` clauses that aggregate the grouped results.
</details>

<details open>
<summary><code>REDUCE function nargs arg [arg ...]</code></summary>

applies an aggregate function to the grouped results.

Common functions include:
- `COUNT` - counts the number of records in each group
- `SUM property` - sums the values of the given property
- `MIN property` - finds minimum value
- `MAX property` - finds maximum value
- `AVG property` - calculates average value
- `STDDEV property` - calculates standard deviation

</details>

<details open>
<summary><code>SORTBY nargs property [ASC|DESC] [property [ASC|DESC] ...] [MAX num]</code></summary>

sorts the results by the given properties.

`nargs` is the number of properties to sort by.
`property` is the property name to sort by.
`ASC|DESC` specifies sort order (default is ASC).
`MAX num` limits the number of results.
</details>

<details open>
<summary><code>LIMIT offset num</code></summary>

limits the results to the offset and number of results given.

The offset is zero-indexed. Default is 0 10.
</details>

<details open>
<summary><code>PARAMS nargs name value [name value ...]</code></summary>

defines one or more value parameters that can be referenced in the query.

Similar to [`FT.SEARCH`](./ft.search.md) PARAMS option.
</details>

## Return

`FT.AGGREGATE` returns an array reply with aggregated results based on the specified grouping and reduction operations.

:::info Limited support
FT.AGGREGATE has partial support in Dragonfly. Some advanced aggregation functions and options may not be fully implemented.
:::

## Examples

<details open>
<summary><b>Group results by category and count</b></summary>

```bash
dragonfly> FT.AGGREGATE products "*" GROUPBY 1 @category REDUCE COUNT 0 AS count
```
</details>

<details open>
<summary><b>Calculate average price by category</b></summary>

```bash
dragonfly> FT.AGGREGATE products "*" GROUPBY 1 @category REDUCE AVG 1 @price AS avg_price
```
</details>

## See also

[`FT.SEARCH`](./ft.search.md) | [`FT.CREATE`](./ft.create.md)

## Related topics

- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)
139 changes: 139 additions & 0 deletions docs/command-reference/search/ft.config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
description: Configure search engine at runtime
---

# FT.CONFIG

## Syntax

FT.CONFIG GET pattern
FT.CONFIG SET option value
FT.CONFIG HELP [option]

**Time complexity:** O(1)

## Description

Configure search engine at runtime.

## Required arguments

<details open>
<summary><code>GET pattern</code></summary>

returns the current values of configuration parameters matching the given pattern.

`pattern` is a glob-style pattern for the configuration parameter names.
</details>

<details open>
<summary><code>SET option value</code></summary>

sets a configuration parameter to the given value.

`option` is the configuration parameter name.
`value` is the new value for the configuration parameter.
</details>

<details open>
<summary><code>HELP [option]</code></summary>

returns help information about configuration parameters.

If `option` is specified, returns help for that specific parameter.
If no option is given, returns help for all available parameters.
</details>

## Available Parameters

DragonflyDB supports the following search configuration parameters:

- **MAXSEARCHRESULTS** - Maximum number of results from ft.search command. Default: `1000000`
- **search.query-string-bytes** - Maximum number of bytes in search query string. Default: `10240`

## Return

- `FT.CONFIG GET` returns an array with parameter names and their values in MAP format.
- `FT.CONFIG SET` returns a simple string reply `OK` if executed correctly, or an error reply otherwise.
- `FT.CONFIG HELP` returns an array of arrays, where each inner array contains 5 elements: parameter name, the string "Description", parameter description, the string "Value", and current value.

## Examples

<details open>
<summary><b>Get all search configuration parameters</b></summary>

```bash
dragonfly> FT.CONFIG GET *
1) "MAXSEARCHRESULTS"
2) "1000000"
3) "search.query-string-bytes"
4) "10240"
```
</details>

<details open>
<summary><b>Set maximum search results</b></summary>

```bash
dragonfly> FT.CONFIG SET MAXSEARCHRESULTS 500000
OK
```
</details>

<details open>
<summary><b>Get help for a specific parameter</b></summary>

```bash
dragonfly> FT.CONFIG HELP MAXSEARCHRESULTS
1) "MAXSEARCHRESULTS"
2) "Description"
3) "Maximum number of results from ft.search command"
4) "Value"
5) "500000"
```
</details>

<details open>
<summary><b>Get a specific configuration parameter</b></summary>

```bash
dragonfly> FT.CONFIG GET search.query-string-bytes
1) "search.query-string-bytes"
2) "10240"
```
</details>

<details open>
<summary><b>Set query string size limit</b></summary>

```bash
dragonfly> FT.CONFIG SET search.query-string-bytes 20480
OK
```
</details>

<details open>
<summary><b>Get help for all parameters</b></summary>

```bash
dragonfly> FT.CONFIG HELP *
1) 1) "MAXSEARCHRESULTS"
2) "Description"
3) "Maximum number of results from ft.search command"
4) "Value"
5) "1000000"
2) 1) "search_query_string_bytes"
2) "Description"
3) "Maximum number of bytes in search query string"
4) "Value"
5) "10240"
```
</details>

## See also

[`FT.CREATE`](./ft.create.md) | [`FT.SEARCH`](./ft.search.md)

## Related topics

- [RediSearch](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/)
Loading