-
Notifications
You must be signed in to change notification settings - Fork 27
doc: ft commands updated #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vyavdoshenko
wants to merge
7
commits into
main
Choose a base branch
from
bobik/ft_commands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
250c030
doc: ft commands updated
vyavdoshenko 6a9ca19
doc: ft commands updated
vyavdoshenko 0ef87e5
doc: FT.DROPINDEX DD option updated
vyavdoshenko 3f667a8
Update docs/command-reference/search/ft.aggregate.md
vyavdoshenko 97e464f
Merge branch 'main' into bobik/ft_commands
vyavdoshenko 5e3523c
fix: links
vyavdoshenko ec4bf76
fix: review comments
vyavdoshenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
vyavdoshenko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## 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/) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.