1.进阶之基于term vector深入探查数据的情况

1、term vector介绍

获取document中的某个field内的各个term的统计信息
term information: term frequency in the field, term positions,start and end offsets, term payloads
term statistics: 设置term_statistics=true; total term frequency, 一个term在所有document出现的频率,document frequency, 有多少document包含这个term
field statistics: document count, 有多少document包含这个field; sum of document frequency, 一个field中所有term的df之和; sum of total term frequency, 一个field中的所有term的tf之和

GET /twitter/tweet/1/_termvector
GET /twitter/tweet/1/_termvector?fields=text

term statistics 和 field statistics并不精准, 不会考虑有的doc可能被删除了

用的时候,一般来说,就是你需要对一些数据做探查的时候。比如说,你想要看到某个term,某个词条,大话西游,这个词条,在多少个document中出现了。或者说某个field,film_desc,电影的说明信息,有多少个doc包含了这个说明信息。

2、index-tiem term vector实验

term vector, 涉及了很多的term和field相关的统计信息,有两种方式可以采集到这个统计信息
(1) index-time, 你在mapping里配置一下,然后建立索引的时候,就直接给你生成这些term和field的统计信息了
(2) query-time, 你之前没有生成过任何的Term vector信息, 然后在查看term vector的时候, 直接就可以看到了, 会on the fly, 现场计算出各种统计信息, 然后返回给你

 

PUT /my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "text": {
          "type": "text",
          "term_vector": "with_positions_offsets_payloads",
          "store": true,
          "analyzer": "fulltext_analyzer"
        },
        "fullname": {
          "type": "text",
          "analyzer": "fulltext_analyzer"
        }
      }
    }
  },
  "settings": {
    "index": {
      "number_of_shards":
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值