From 17205fc2bc20c3fcb3bd948212ca37ac33bf7829 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:10:07 +0700 Subject: [PATCH] refactor: change from word match to wildcard --- src/controllers/log-controller.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/controllers/log-controller.ts b/src/controllers/log-controller.ts index 7e1d7a7..4a5ede5 100644 --- a/src/controllers/log-controller.ts +++ b/src/controllers/log-controller.ts @@ -49,14 +49,11 @@ export class LogController extends Controller { ? [ { bool: { - should: [ - { - multi_match: { - query: search, - fields: ["method", "logType", "endpoint", "host", "responseCode"], - }, - }, - ], + should: ["method", "logType", "endpoint", "host", "responseCode"].map( + (v) => ({ + wildcard: { [v]: "*" + search + "*" }, + }), + ), }, }, ]