嘿~ 今天天气不错嘛

3节点es集群,峰值5kw数据,查询慢,第一次最长耗时5s(求大佬指教)

Elasticsearch | 作者 mryu | 发布于2019年12月13日 | 阅读数:1927

1、调整了jvm
2、按照官网得优化方式配置了参数
没有开启全局序数

下边是查询dsl:

{
"from": 0,
"size": 10,
"timeout": "4s",
"query": {
"bool": {
"must": [
{
"bool": {
"must_not": [
{
"terms": {
"m_site_id": [
"8256",
"8325",
"19810",
"26361",
"28770",
"28771",
"28772",
"28773",
"28774",
"28776",
"28777",
"28778",
"28779"
],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"bool": {
"should": [
{
"term": {
"g_asp": {
"value": "Baidu",
"boost": 1.0
}
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "g_asp",
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"bool": {
"must": [
{
"query_string": {
"query": "微博 罗永浩",
"fields": [
"m_content^1.0",
"m_title^1.0"
],
"type": "best_fields",
"default_operator": "and",
"max_determinized_states": 10000,
"enable_position_increments": true,
"fuzziness": "1",
"fuzzy_prefix_length": 0,
"fuzzy_max_expansions": 50,
"phrase_slop": 0,
"escape": false,
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"bool": {
"must": [
{
"range": {
"m_publish_time": {
"from": "2019-11-20 08:59:55",
"to": "2019-11-22 08:59:55",
"include_lower": true,
"include_upper": true,
"boost": 1.0
}
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "m_url",
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
{
"bool": {
"must_not": [
{
"terms": {
"m_sys_lttb_status": [
"23/01",
"23/02"
],
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"sort": [
{
"m_publish_time": {
"order": "desc"
}
}
],
"track_total_hits": 2147483647
}
已邀请:
匿名用户

匿名用户

赞同来自:

5秒已经很快了,不需要优化了。

tacsklet - 公司有用到es

赞同来自:

使用profile:true看一下执行计划

jiangzhuoyan

赞同来自:

试一下,把一些term的查询放到filter里面

mryu

赞同来自:

设置了 refresh_interval为30s,把时间筛选和term过滤提前,query_string放了最后,初步测试简单词查询可以毫秒级返回,复杂的以及大于10个字的查询基本可以一秒左右返回。结合业务测试后再做结论,哈哈

要回复问题请先登录注册