

继续跟中华石杉老师学习ES,第61篇
课程地址: https://www.roncoo.com/view/55
Term Vectors: 戳这里
概括来说:Term Vectors就是 获取document中的某个field内的各个term的统计信息


主要包含以下几个信息: term frequency in the field, term positions, start and end offsets, term payloads

设置term_statistics=true 后将返回:


GET /my_index/my_type/_termvectors
{
"doc" : {
"fullname" : "Leo Li",
"text" : "hello test test test"
},
"fields" : ["text"],
"offsets" : true,
"payloads" : true,
"positions" : true,
"term_statistics" : true,
"field_statistics" : true,
"filter" : {
"max_num_terms" : 3,
"min_term_freq" : 1,
"min_doc_freq" : 1
}
}这个就是说,根据term统计信息,过滤出你想要看到的term vector统计结果 也挺有用的,比如你探查数据把,可以过滤掉一些出现频率过低的term,就不考虑了 .

term statistics和field statistics并不精准,被删除了的doc不会被考虑.
其实Term Vectors很少用,用的时候,一般来说,就是你需要对一些数据做探查的时候。比如说,你想要看到某个term,某个词条比如“xxxx”,这个词条,在多少个document中出现了。或者说某个field 比如 film_desc(电影的说明信息),有多少个doc包含了这个说明信息。