elastic display parameter
This is the company's search statement
post eops-supervision-slow-mysql-2023.02.27-2023.03.05/doc/_search
{
"from": 0,
"size": 1,
"query": {
"bool": {
"filter": [{
"match": {
"hasSupervision": {
"query": 0,
"operator": "OR",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 1.0
}
}
}, {
"range": {
"queryTx": {
"from": "2023-02-26T15:47:00",
"to": "2023-02-27T15:57:00",
"include_lower": false,
"include_upper": true,
"boost": 1.0
}
}
}],
"must_not": [{
"term": {
"appsysid": {
"value": 1,
"boost": 1.0
}
}
}],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"version": true,
"aggregations": {
"by_time": {
"date_histogram": {
"field": "queryTx",
"format": "8yyyy-MM-dd HH:mm:ss",
"interval": "300s",
"offset": 56820000,
"order": {
"_key": "asc"
},
"keyed": false,
"count": 1
},
"aggregations": {
"groupByDbId": {
"terms": {
"field": "dbId",
"size": 2147483647,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [{
"_count": "desc"
}, {
"_key": "asc"
}]
},
"aggregations": {
"groupByFingerId": {
"terms": {
"field": "fingerId",
"size": 2147483647,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [{
"_count": "desc"
}, {
"avg_time": "desc"
}, {
"_key": "asc"
}]
},
"aggregations": {
"avg_time": {
"avg": {
"field": "queryTime"
}
},
"having": {
"bucket_selector": {
"buckets_path": {
"avgTime": "avg_time",
"exeCount": "_count"
},
"script": {
"source": "params.avgTime > 0.1 && params.exeCount > 1",
"lang": "painless"
},
"gap_policy": "skip"
}
}
}
}
}
}
}
}
}
}
This is the display result
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 0.0,
"hits" : [
{
"_index" : "eops-supervision-slow-mysql-2023.02.27-2023.03.05",
"_type" : "_doc",
"_id" : "94043279",
"_version" : 1,
"_score" : 0.0,
"_source" : {
"id" : 94043279,
"dbId" : 13,
"queryTx" : "2023-02-27T14:40:08",
"slowSchema" : "eops",
"md5Sql" : "6c2fbc5cb0c4edf496546398cca05eff0f712b56dc46cc8f2a5d9309708c2780",
"queryLength" : "39",
"queryTime" : 3.659591,
"queryHost" : "10.11.0.221(8806)",
"queryUser" : "eops",
"slowSql" : "select * from mysql_supervision limit 1",
"slowFinger" : "select * from `mysql_supervision` limit ?",
"optmize" : "SET timestamp=1677480008,now()=1677485825575,sDateFormat=Mon Feb 27 14:40:08 CST 2023,slowMysql.getQueryTx()Mon Feb 27 14:40:08 CST 2023,insert之前的QueryTx====Mon Feb 27 14:40:08 CST 2023,insert之后的QueryTx====Mon Feb 27 14:40:08 CST 2023,offset====18",
"fingerId" : 500721,
"appsysid" : 21,
"appsysidSource" : 4,
"schemaSource" : 2,
"appName" : null,
"examplesName" : "10.11.0.221_8806",
"dbType" : 1,
"number" : 1,
"avgTime" : null,
"allTime" : null,
"isBroadcast" : null,
"lockTime" : "0.000175",
"fullScan" : "否",
"fullJoin" : "否",
"filesortOnDisk" : "否",
"filesort" : "否",
"tmpTable" : "否",
"tmpTableOnDisk" : "否",
"checkLevel" : 0,
"handleComment" : null,
"rowsSent" : 0,
"rowsExamined" : 1,
"errorMsg" : "",
"createTime" : "2023-02-27 16:17:27",
"hasSupervision" : 0,
"initialMsg" : null,
"queryTxNum" : 1677480008000,
"isWhite" : null
}
}
]
},
"aggregations" : {
"by_time" : {
"buckets" : [
{
"key_as_string" : "2023-02-27 14:37:00",
"key" : 1677508620000,
"doc_count" : 4,
"groupByDbId" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : 13,
"doc_count" : 4,
"groupByFingerId" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : 500720,
"doc_count" : 2,
"avg_time" : {
"value" : 8.659590721130371
}
},
{
"key" : 500721,
"doc_count" : 2,
"avg_time" : {
"value" : 3.65959095954895
}
}
]
}
}
]
}
}
]
}
}
}
How do I change the query to include one more parameter, such as initialMsg?