找到问题的解决办法了么?

next_doc占据了1/3甚至更久的时间,这正常吗?

Elasticsearch | 作者 Leeeo | 发布于2018年12月28日 | 阅读数:2504

感谢大神指点,查询语句中加上
  "profile": true,
可以看到每一步的耗时。
 以下是其中一个shad的耗时统计,请问next_doc占据了近1/3的时间,这正常吗?
是不是因为我们一个shad中数据过多,需要(重建索引)增大shad数? 
               "time_in_nanos": 2238434609,
                "breakdown": {
                  "score": 341004973,
                  "build_scorer_count": 49,
                  "match_count": 37,
                  "create_weight": 443801477,
                  "next_doc": 939474127,
                  "match": 205102762,
                  "create_weight_count": 1,
                  "next_doc_count": 71,
                  "score_count": 12,
                  "build_scorer": 309051100,
                  "advance": 0,
                  "advance_count": 0
                },
已邀请:

rochy - rochy_he

赞同来自:

可以把查询的 DSL 贴一下看看

Leeeo - 90后IT男

赞同来自:

@rochy
{
    "query": {
        "bool": {
            "filter": {
                "bool": {
                    "must": [{
                        "bool": {
                            "should": [{
                                "term": {
                                    "profession": "170"
                                }
                            }]
                        }
                    },
                    {
                        "bool": {
                            "should": []
                        }
                    },
                    {
                        "range": {
                            "refresh_time": {
                                "gte": "20180701"
                            }
                        }
                    },
                    {
                        "range": {
                            "res_level": {
                                "gte": 1
                            }
                        }
                    },
                    {
                        "term": {
                            "res_category": 1
                        }
                    },
                    {
                        "range": {
                            "degree": {
                                "lte": "050"
                            }
                        }
                    },
                    {
                        "range": {
                            "start_work_year": {
                                "lte": 2012
                            }
                        }
                    },
                    {
                        "range": {
                            "expected_salary_4_recom": {
                                "lte": 182000
                            }
                        }
                    },
                    {
                        "range": {
                            "salary": {
                                "gte": 78000
                            }
                        }
                    },
                    {
                        "bool": {
                            "should": [{
                                "term": {
                                    "expected_city_4_recom": "170"
                                }
                            },
                            {
                                "prefix": {
                                    "expected_city_4_recom": "170020"
                                }
                            }]
                        }
                    },
                    {
                        "bool": {
                            "should": [{
                                "term": {
                                    "open_to": "0"
                                }
                            },
                            {
                                "term": {
                                    "open_to": "2"
                                }
                            }]
                        }
                    },
                    {
                        "range": {
                            "user_id": {
                                "gt": 0
                            }
                        }
                    }]
                }
            }
        }
    },
    "_source": ["user_id",
    "login_date",
    "res_stats_count"],
    "size": 200
}

要回复问题请先登录注册