--- acl_categories: - '@dangerous' - '@read' - '@search' - '@slow' arguments: - name: index type: string - name: field_name type: string categories: - docs - develop - stack - oss - rs - rc - oss - kubernetes - clients command_flags: - readonly complexity: O(N) description: Returns the distinct tags indexed in a Tag field doc_flags: - deprecated group: search hidden: false linkTitle: FT.TAGVALS module: Search railroad_diagram: /images/railroad/ft.tagvals.svg since: 1.0.0 stack_path: docs/interact/search-and-query summary: Returns the distinct tags indexed in a Tag field syntax_fmt: FT.TAGVALS index field_name title: FT.TAGVALS --- Return a distinct set of values indexed in a Tag field [Examples](#examples) ## Required arguments
index is full-text index name. You must first create the index using [`FT.CREATE`]({{< relref "commands/ft.create/" >}}).
field_name is name of a Tag file defined in the schema.
Use FT.TAGVALS if your tag indexes things like cities, categories, and so on. ## Limitations FT.TAGVALS provides no paging or sorting, and the tags are not alphabetically sorted. FT.TAGVALS only operates on [tag fields]({{< relref "/develop/ai/search-and-query/advanced-concepts/tags" >}}). The returned strings are lowercase with whitespaces removed, but otherwise unchanged. ## Examples
Return a set of values indexed in a Tag field {{< highlight bash >}} 127.0.0.1:6379> FT.TAGVALS idx myTag 1) "Hello" 2) "World" {{< / highlight >}}
## Redis Software and Redis Cloud compatibility | Redis
Software | Redis Cloud
Flexible & Annual | Redis Cloud
Free & Fixed | Notes | |:----------------------|:-----------------|:-----------------|:------| | ✅ Supported | ✅ Supported | ✅ Supported | | ## Return information {{< multitabs id="ft-tagvals-return-info" tab1="RESP2" tab2="RESP3" >}} One of the following: * [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of distinct tag values as [bulk strings]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}). * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: no such index, not a tag field. -tab-sep- One of the following: * [Set]({{< relref "/develop/reference/protocol-spec#sets" >}}) of distinct tag values as [bulk strings]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}). * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: no such index, not a tag field. {{< /multitabs >}} ## See also [`FT.CREATE`]({{< relref "commands/ft.create/" >}}) ## Related topics - [Tag fields]({{< relref "/develop/ai/search-and-query/advanced-concepts/tags" >}}) - [RediSearch]({{< relref "/develop/ai/search-and-query/" >}})