Commit 5a2c0822 by 宋毅

tj

parent 5c039192
...@@ -63,51 +63,52 @@ class UtilsLogsService extends AppServiceBase { ...@@ -63,51 +63,52 @@ class UtilsLogsService extends AppServiceBase {
] ]
} }
if (actionBody.opTitle) { if (actionBody.opTitle) {
// params.query.bool.must.push({
// "query_string": {
// "default_field": "opTitle",
// "query": '\"' + actionBody.opTitle + '\"'
// }
// });
params.query.bool.must.push({ params.query.bool.must.push({
"query_string": { "wildcard": {
"default_field": "opTitle", "opTitle": "*" + actionBody.opTitle + "*"
"query": '\"' + actionBody.opTitle + '\"'
} }
}); });
} }
if (actionBody.identifyCode) { if (actionBody.identifyCode) {
params.query.bool.must.push({ params.query.bool.must.push({
"query_string": { "wildcard": {
"default_field": "identifyCode", "identifyCode": "*" + actionBody.identifyCode + "*"
"query": '\"' + actionBody.identifyCode + '\"'
} }
}); });
} }
if (actionBody.messageBody) { if (actionBody.messageBody) {
params.query.bool.must.push({ params.query.bool.must.push({
"query_string": { "wildcard": {
"default_field": "messageBody", "messageBody": "*" + actionBody.messageBody + "*"
"query": '\"' + actionBody.messageBody + '\"'
} }
}); });
} }
if (actionBody.errorInfo) { if (actionBody.errorInfo) {
params.query.bool.must.push({ params.query.bool.must.push({
"query_string": { "wildcard": {
"default_field": "errorInfo", "errorInfo": "*" + actionBody.errorInfo + "*"
"query": '\"' + actionBody.errorInfo + '\"'
} }
}); });
} }
if (actionBody.requestId) { if (actionBody.requestId) {
params.query.bool.must.push({ params.query.bool.must.push({
"query_string": { "wildcard": {
"default_field": "requestId", "requestId": "*" + actionBody.requestId + "*"
"query": '\"' + actionBody.requestId + '\"'
} }
}); });
} }
var resultData = null; var resultData = null;
try { try {
resultData = await this.esUtils.execPostEs(settings.queuedName, params, esIndexName); resultData = await this.esUtils.execPostEs(settings.queuedName, params, esIndexName);
var sources = []; var sources = [];
var data = { var data = {
"totalCount": resultData.data && resultData.data.hits ? resultData.data.hits.total : 0, "totalCount": 0,
"pageSize": pageSize, "pageSize": pageSize,
"currentPage": from === 0 ? from : (from - 1), "currentPage": from === 0 ? from : (from - 1),
"list": sources "list": sources
...@@ -121,6 +122,7 @@ class UtilsLogsService extends AppServiceBase { ...@@ -121,6 +122,7 @@ class UtilsLogsService extends AppServiceBase {
if (!resultData.data.hits.hits || resultData.data.hits.hits.length === 0) { if (!resultData.data.hits.hits || resultData.data.hits.hits.length === 0) {
return system.getResult(null, "data is empty!"); return system.getResult(null, "data is empty!");
} }
data.totalCount = typeof resultData.data.hits.total === "object" ? resultData.data.hits.total.value : resultData.data.hits.total;
resultData.data.hits.hits.forEach(function (c) { resultData.data.hits.hits.forEach(function (c) {
var source = { var source = {
"opTitle": c._source.opTitle, "opTitle": c._source.opTitle,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment