diff --git a/zlt-monitor/log-center/src/main/java/com/central/log/controller/SlowQueryLogController.java b/zlt-monitor/log-center/src/main/java/com/central/log/controller/SlowQueryLogController.java index 0c974b66..a3919844 100644 --- a/zlt-monitor/log-center/src/main/java/com/central/log/controller/SlowQueryLogController.java +++ b/zlt-monitor/log-center/src/main/java/com/central/log/controller/SlowQueryLogController.java @@ -38,11 +38,9 @@ public class SlowQueryLogController extends LogController { BoolQueryBuilder builder = QueryBuilders.boolQuery(); String searchKey = (String) params.get("searchKey"); String searchValue = (String) params.get("searchValue"); - if (StrUtil.isNotEmpty(searchKey)) { - if (ES_PARAM_QUERY.equals(searchKey)) { - // 模糊查询 - builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_QUERY, searchValue.toUpperCase())); - } + if (StrUtil.isNotEmpty(searchKey) && StrUtil.isNotEmpty(searchValue)) { + // 模糊查询 + builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_QUERY, searchValue)); } return super.getPage(params, builder, logDao); diff --git a/zlt-monitor/log-center/src/main/java/com/central/log/controller/SysLogController.java b/zlt-monitor/log-center/src/main/java/com/central/log/controller/SysLogController.java index a861d812..f03e41f7 100644 --- a/zlt-monitor/log-center/src/main/java/com/central/log/controller/SysLogController.java +++ b/zlt-monitor/log-center/src/main/java/com/central/log/controller/SysLogController.java @@ -40,25 +40,13 @@ public class SysLogController extends LogController { BoolQueryBuilder builder = QueryBuilders.boolQuery(); String searchKey = (String) params.get("searchKey"); String searchValue = (String) params.get("searchValue"); - if (StrUtil.isNotEmpty(searchKey)) { - if (ES_PARAM_MESSAGE.equals(searchKey)) { - // 整词模糊查询 日志信息 - builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_MESSAGE, searchValue)); - } + if (StrUtil.isNotEmpty(searchKey) && StrUtil.isNotEmpty(searchValue)) { if (ES_PARAM_LOG_LEVEL.equals(searchKey)) { - // 模糊查询 - builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_LOG_LEVEL, searchValue.toUpperCase())); - } - if (ES_PARAM_APP_NAME.equals(searchKey)) { - // 模糊查询 - builder.must(QueryBuilders.fuzzyQuery(ES_PARAM_APP_NAME, searchValue)); - } - if (ES_PARAM_CLASSNAME.equals(searchKey)) { - // 模糊查询 - builder.must(QueryBuilders.fuzzyQuery(ES_PARAM_CLASSNAME, searchValue)); + searchValue = searchValue.toUpperCase(); } + // 模糊查询 + builder.must(QueryBuilders.matchPhraseQuery(searchKey, searchValue)); } - return super.getPage(params, builder, logDao); } }