如何计算一组文档中出现次数最多的单词,然后执行子聚合

时间:2019-10-28 07:22:19

标签: elasticsearch elasticsearch-php

通过 Elasticsearch查询,我可以生成大约5000个文档 现在,我正在尝试确定出现最多的非停用词(停用词是辅助动词/非重要词)。

因此,我使用 significant_text 聚合

尝试了此查询
$params2 = [
    'index' => ["web", "print"],
    'type'  => 'index',
    'from'  => 0,
    'size'  => 10000,
    'filter_path' => ['aggregations'],
    'body'  => [
        "query" => //omitted query here
        'aggs' => [
            'SIGNIFICANT' => [
                "significant_text" => [
                    "field" => "content"
                ]
            ]
        ]
    ]
];

不幸的是,它仍然显示一些对我来说不重要garbage words

enter image description here

我的问题:
1. significant_text聚合有替代方法吗?

  1. 我还想在此terms主agg之后执行significant_text子聚合,因为我想组合一个查询以了解流行词,然后根据其他字段过滤文档

如果您对如何执行所需的过程和输出有所了解,将不胜感激

0 个答案:

没有答案