用了Elasticsearch,一口气上5T

es2.4.5 dsl聚合优化

Elasticsearch | 作者 lz8086 | 发布于2018年05月18日 | 阅读数:2785

麻烦大牛解惑下:目前有3亿条数据,按照某字段聚合时响应时间太慢。已经拆分过DSL,目前最慢达到30s,还能怎么优化呢?
 
{
"size": 0,
"query": {
"bool": {
"must": {
"bool": {
"should": {
"terms": {
"hour_tag": [
"00-07",
"08-11",
"18-23"
]
}
}
}
}
}
},
"explain": true,
"aggregations": {
"proName": {
"terms": {
"field": "pro_name",
"size": 1
}
},
"sex": {
"terms": {
"field": "sex",
"size": 10000
}
}
}
}
已经尝试添加过"collect_mode": "breadth_first"和"execution_hint": "map"字段,但效果并不好,甚至更差。应该是文档数量较多此方法不太合适了吧。
已邀请:

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自:

要回复问题请先登录注册