--- acl_categories: - '@search' arguments: - name: key type: string - name: prefix type: string - name: fuzzy optional: true token: FUZZY type: pure-token - name: withscores optional: true token: WITHSCORES type: pure-token - name: withpayloads optional: true token: WITHPAYLOADS type: pure-token - name: max optional: true token: MAX type: integer categories: - docs - develop - stack - oss - rs - rc - oss - kubernetes - clients command_flags: - readonly complexity: O(1) description: Gets completion suggestions for a prefix group: suggestion hidden: false history: - - 2.0.0 - Deprecated `WITHPAYLOADS` argument linkTitle: FT.SUGGET module: Search railroad_diagram: /images/railroad/ft.sugget.svg since: 1.0.0 stack_path: docs/interact/search-and-query summary: Gets completion suggestions for a prefix syntax: "FT.SUGGET key prefix \n [FUZZY] \n [WITHSCORES] \n [WITHPAYLOADS] \n \ \ [MAX max]\n" syntax_fmt: "FT.SUGGET key prefix [FUZZY] [WITHSCORES] [WITHPAYLOADS] [MAX\_max]" title: FT.SUGGET --- Get completion suggestions for a prefix ## Required arguments
key is suggestion dictionary key.
prefix is prefix to complete on.
## Optional arguments
FUZZY performs a fuzzy prefix search, including prefixes at Levenshtein distance of 1 from the prefix sent.
MAX num limits the results to a maximum of `num` (default: 5).
WITHSCORES also returns the score of each suggestion. This can be used to merge results from multiple instances.
WITHPAYLOADS returns optional payloads saved along with the suggestions. If no payload is present for an entry, it returns a null reply.
## Return FT.SUGGET returns an array reply, which is a list of the top suggestions matching the prefix, optionally with score after each entry. ## Example
Get completion suggestions for a prefix {{< highlight bash >}} 127.0.0.1:6379> FT.SUGGET sug hell FUZZY MAX 3 WITHSCORES 1) "hell" 2) "2147483648" 3) "hello" 4) "0.70710676908493042" {{< / highlight >}}
## Redis Software and Redis Cloud compatibility | Redis
Software | Redis
Cloud | Notes | |:----------------------|:-----------------|:------| | ✅ Standard
❌ Active-Active | ❌ Standard
❌ Active-Active | Not supported on clustered databases. | ## Return information {{< multitabs id="ft-sugget-return-info" tab1="RESP2" tab2="RESP3" >}} [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of the top suggestions matching the prefix, optionally with a score after each entry. -tab-sep- [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of the top suggestions matching the prefix, optionally with a score after each entry. {{< /multitabs >}} ## See also [`FT.SUGADD`]({{< relref "commands/ft.sugadd/" >}}) | [`FT.SUGDEL`]({{< relref "commands/ft.sugdel/" >}}) | [`FT.SUGLEN`]({{< relref "commands/ft.suglen/" >}}) ## Related topics [RediSearch]({{< relref "/develop/ai/search-and-query/" >}})