V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
k8ser
V2EX  ›  Elasticsearch

ES 如何聚合 terms 统计词频?

  •  
  •   k8ser · 2021-10-20 14:40:31 +08:00 · 1042 次点击
    这是一个创建于 891 天前的主题,其中的信息可能已经有所发展或是发生改变。

    message 字段是 text 且 fielddata=true;想使用 IK 统计索引中所有分词后的 terms 的出现频率。

    一 聚合是聚合带有 terms 的 doc_count; 二 虽然能聚合出单条数据 terms,但是需要指定 doc 还是不能聚合出索引内所有 terms;

    是不是非常消耗性能 es 不支持这么操作???请大佬指教。

    一:
    POST message_index/_search
     {
        "size" : 0,  
         "aggs" : {   
            "messages" : {   
                  "terms" : {   
                  	"size" : 10,
                  	"field" : "message"
                 }  
            }  
        }
    }
    二:
    GET /message_index/_doc/cFFUnHwB886e1Yi8F6TJ/_termvectors
      {
        "fields" : ["message"],
        "offsets" : true,
        "payloads" : true,
        "positions" : true,
        "term_statistics" : true,
        "field_statistics" : true
      }
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5337 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 08:09 · PVG 16:09 · LAX 01:09 · JFK 04:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.