请问以下的语句有什么优化方案吗?环境:
8核16G、400G高速硬盘、单机es实例,4个数据节点,每个节点100G空间
背景:
查询的索引有2000多w数据,查询时间大概在2~3s左右
查询语句:{
"size": 0,
"query": {
"bool": {
"must": [
{
"terms": {
"modeId": [
1,
2
],
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"aggregations": {
"question_id_buckets": {
"terms": {
"field": "questionId",
"size": 200,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
}
}
}
}
search profiler:
8核16G、400G高速硬盘、单机es实例,4个数据节点,每个节点100G空间
背景:
查询的索引有2000多w数据,查询时间大概在2~3s左右
查询语句:{
"size": 0,
"query": {
"bool": {
"must": [
{
"terms": {
"modeId": [
1,
2
],
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"aggregations": {
"question_id_buckets": {
"terms": {
"field": "questionId",
"size": 200,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
}
}
}
}
search profiler:
1 个回复
cap_ljf
赞同来自:
2. eager_global_ordinals 如果你的数据写少读多,可以修改聚合字段fielddata更新时机