Elasticsearch插件来分类文档 [英] Elasticsearch plugin to classify documents

查看:103
本文介绍了Elasticsearch插件来分类文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



对我而言,最好的解决方案是将其分类为所有最常见的术语(/概念)以用户可以浏览的标签云显示。



有没有办法实现?任何建议?



谢谢

解决方案

基本思想是使用 条款聚合,每个条款将产生一个桶。

  POST / _search 
{
aggs:{
genres:{
terms:{field:genre}
}
}
}

您将获得的回复将通过减少期限出现次数排序:

  {
...

聚合:{
类型:{
doc_count_error_upper_bound:0,
sum_other_doc_count:0,
buckets:[
{
key:jazz
doc_count:10
},
{
key:rock,
doc_count:5
},
{
key:electronic,
doc_count:2
},
]
}
}
}

如果您使用Kibana,可以直接创建一个标签云可视化。


Is there an elasticsearch plugin out there that would allow me to classify the documents that I enter in an index?

The best solution for me would be a classifications of all the most recurrent terms (/ concepts) displayed in a sort of tags cloud that the user can navigate.

Is there a way to achieve this? Any suggestions?

Thanks

解决方案

The basic idea is to use a terms aggregations, which will yield one bucket per term.

POST /_search
{
    "aggs" : {
        "genres" : {
            "terms" : { "field" : "genre" }
        }
    }
}

The response you'll get will be ordered by decreasing amount of term occurrences:

{
    ...

    "aggregations" : {
        "genres" : {
            "doc_count_error_upper_bound": 0, 
            "sum_other_doc_count": 0, 
            "buckets" : [ 
                {
                    "key" : "jazz",
                    "doc_count" : 10
                },
                {
                    "key" : "rock",
                    "doc_count" : 5
                },
                {
                    "key" : "electronic",
                    "doc_count" : 2
                },
            ]
        }
    }
}

If you're using Kibana, you can directly create a tag cloud visualization based on those terms.

这篇关于Elasticsearch插件来分类文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆