FT.INFO
语法
FT.INFO index
- 可用版本
- Redis Open Source / Search 1.0.0
- 时间复杂度
- O(1)
- ACL 类别
-
@search,
返回给定索引的信息和统计数据。
必需参数
index
是给定索引的名称。您必须先使用 FT.CREATE 创建该索引。
RESP 回复
FT.INFO 返回一个数组回复,其中包含键值对。
返回值
通用
| 返回字段名称 | 定义 |
|---|---|
index_name |
创建索引时定义的索引名称。 |
index_options |
在 FT.CREATE 期间选择的索引选项,例如 FILTER {filter}、LANGUAGE {default_lang} 等。 |
index_definition |
包括 key_type(哈希或 JSON);prefixes(如果存在);以及 default_score。 |
attributes |
索引模式字段名称、类型和属性。 |
num_docs |
文档数量。 |
max_doc_id |
最大文档 ID。 |
num_terms |
不同术语的数量。 |
num_records |
记录总数。 |
各种大小统计数据
| 统计项 | 定义 |
|---|---|
inverted_sz_mb |
倒排索引使用的内存大小。倒排索引是 RediSearch 中用于搜索的核心数据结构。大小以兆字节为单位。 |
vector_index_sz_mb |
向量索引使用的内存大小,用于存储与每个文档关联的向量。 |
total_inverted_index_blocks |
倒排索引中的块总数。 |
offset_vectors_sz_mb |
偏移量向量使用的内存大小,用于存储文档中术语的位置信息。 |
doc_table_size_mb |
文档表使用的内存大小,其中包含索引中每个文档的元数据。 |
sortable_values_size_mb |
可排序值使用的内存大小,这些值与文档关联并用于排序。 |
key_table_size_mb |
键表使用的内存大小,用于存储文档 ID 和 Redis 键之间的映射。 |
geoshapes_sz_mb |
GEO 相关字段使用的内存大小。 |
records_per_doc_avg |
每个文档的平均记录数(包括删除)。 |
bytes_per_record_avg |
每条记录的平均大小(字节)。 |
offsets_per_term_avg |
每个术语的平均偏移量(位置信息)。 |
offset_bits_per_record_avg |
每条记录用于偏移量的平均位数。 |
索引相关统计数据
| 统计项 | 定义 |
|---|---|
hash_indexing_failures |
索引过程中遇到的失败次数。 |
total_indexing_time |
索引总耗时(秒)。 |
indexing |
指示索引是否正在生成。 |
percent_indexed |
已成功生成的索引百分比(1 表示 100%)。 |
number_of_uses |
索引已被使用的次数。 |
cleaning |
索引删除标志。值 1 表示正在进行索引删除。 |
垃圾回收统计数据
| 统计项 | 定义 |
|---|---|
bytes_collected |
垃圾回收期间收集的字节数。 |
total_ms_run |
垃圾回收总耗时(毫秒)。 |
total_cycles |
垃圾回收总周期数。 |
average_cycle_time_ms |
每个垃圾回收周期的平均耗时(毫秒)。值 nan 表示平均周期时间不可用。 |
last_run_time_ms |
上次垃圾回收运行所用的时间(毫秒)。 |
以下两个与 GC 相关的字段适用于父进程和子进程在同一内存区域同时发生更改,导致父进程丢弃这些更改的场景。
| 统计项 | 定义 |
|---|---|
gc_numeric_trees_missed |
在垃圾回收期间,由于父进程拆分而导致更改被丢弃的数值树节点数量。 |
gc_blocks_denied |
在垃圾回收期间,由于父进程修改而导致更改被丢弃(跳过)的块数量。值得注意的是,由于倒排索引块是仅追加的,因此只能跳过倒排索引的最后一个块。 |
游标统计数据
| 统计项 | 定义 |
|---|---|
global_idle |
系统中空闲游标的数量。 |
global_total |
系统中游标总数。 |
index_capacity |
每个索引允许的最大游标数量。 |
index_total |
索引上打开的游标总数。 |
其他统计数据
- 方言统计:索引使用每个 DIALECT(1 - 4)进行搜索的次数。
- 索引错误统计数据,包括
indexing failures、last indexing error和last indexing error key。 - 字段统计数据,包括每个模式字段的
indexing failures、last indexing error和last indexing error key。
示例
返回索引的统计数据
127.0.0.1:6379> ft.info idx:bicycle
1) index_name
2) idx:bicycle
3) index_options
4) (empty array)
5) index_definition
6) 1) key_type
2) JSON
3) prefixes
4) 1) bicycle:
5) default_score
6) "1"
7) attributes
8) 1) 1) identifier
2) $.pickup_zone
3) attribute
4) pickup_zone
5) type
6) GEOSHAPE
7) coord_system
8) SPHERICAL
2) 1) identifier
2) $.store_location
3) attribute
4) store_location
5) type
6) GEO
3) 1) identifier
2) $.brand
3) attribute
4) brand
5) type
6) TEXT
7) WEIGHT
8) "1"
4) 1) identifier
2) $.model
3) attribute
4) model
5) type
6) TEXT
7) WEIGHT
8) "1"
5) 1) identifier
2) $.description
3) attribute
4) description
5) type
6) TEXT
7) WEIGHT
8) "1"
6) 1) identifier
2) $.price
3) attribute
4) price
5) type
6) NUMERIC
7) 1) identifier
2) $.condition
3) attribute
4) condition
5) type
6) TAG
7) SEPARATOR
8) ,
9) num_docs
10) "10"
11) max_doc_id
12) "10"
13) num_terms
14) "546"
15) num_records
16) "692"
17) inverted_sz_mb
18) "0.003993034362792969"
19) vector_index_sz_mb
20) "0"
21) total_inverted_index_blocks
22) "551"
23) offset_vectors_sz_mb
24) "7.047653198242188e-4"
25) doc_table_size_mb
26) "7.152557373046875e-4"
27) sortable_values_size_mb
28) "0"
29) key_table_size_mb
30) "3.0422210693359375e-4"
31) geoshapes_sz_mb
32) "0.00426483154296875"
33) records_per_doc_avg
34) "69.19999694824219"
35) bytes_per_record_avg
36) "6.0505781173706055"
37) offsets_per_term_avg
38) "1.0679190158843994"
39) offset_bits_per_record_avg
40) "8"
41) hash_indexing_failures
42) "0"
43) total_indexing_time
44) "4.539999961853027"
45) indexing
46) "0"
47) percent_indexed
48) "1"
49) number_of_uses
50) (integer) 1
51) cleaning
52) (integer) 0
53) gc_stats
54) 1) bytes_collected
2) "0"
3) total_ms_run
4) "0"
5) total_cycles
6) "0"
7) average_cycle_time_ms
8) "nan"
9) last_run_time_ms
10) "0"
11) gc_numeric_trees_missed
12) "0"
13) gc_blocks_denied
14) "0"
55) cursor_stats
56) 1) global_idle
2) (integer) 0
3) global_total
4) (integer) 0
5) index_capacity
6) (integer) 128
7) index_total
8) (integer) 0
57) dialect_stats
58) 1) dialect_1
2) (integer) 0
3) dialect_2
4) (integer) 0
5) dialect_3
6) (integer) 0
7) dialect_4
8) (integer) 0
59) Index Errors
60) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
61) field statistics
62) 1) 1) identifier
2) $.pickup_zone
3) attribute
4) pickup_zone
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
2) 1) identifier
2) $.store_location
3) attribute
4) store_location
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
3) 1) identifier
2) $.brand
3) attribute
4) brand
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
4) 1) identifier
2) $.model
3) attribute
4) model
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
5) 1) identifier
2) $.description
3) attribute
4) description
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
6) 1) identifier
2) $.price
3) attribute
4) price
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"
7) 1) identifier
2) $.condition
3) attribute
4) condition
5) Index Errors
6) 1) indexing failures
2) (integer) 0
3) last indexing error
4) N/A
5) last indexing error key
6) "N/A"