Elasticsearch插件来分类文档 [英] Elasticsearch plugin to classify documents
问题描述
对我而言,最好的解决方案是将其分类为所有最常见的术语(/概念)以用户可以浏览的标签云显示。
有没有办法实现?任何建议?
谢谢
基本思想是使用 条款
聚合,每个条款将产生一个桶。
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屋!