From 219249873dda069d102f3a753ea0668c561dcaed Mon Sep 17 00:00:00 2001 From: AgOH <50107074+StableAgOH@users.noreply.github.com> Date: Fri, 25 Mar 2022 11:40:14 +0800 Subject: [PATCH] elastic: use term op instead of match (#328) --- packages/elastic/script.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/elastic/script.ts b/packages/elastic/script.ts index 0e269e476..7b93a9061 100644 --- a/packages/elastic/script.ts +++ b/packages/elastic/script.ts @@ -49,7 +49,7 @@ global.Hydro.lib.problemSearch = async (domainId, q, opts) => { post_filter: { bool: { minimum_should_match: 1, - should: domainIds.map((i) => ({ match: { domainId: i } })), + should: domainIds.map((i) => ({ term: { domainId: i } })), }, }, }); @@ -64,7 +64,7 @@ export const description = 'Elastic problem search re-index'; export async function run({ domainId }, report) { try { - if (domainId) await client.deleteByQuery({ index: 'problem', query: { match: { domainId } } }); + if (domainId) await client.deleteByQuery({ index: 'problem', query: { term: { domainId } } }); else await client.deleteByQuery({ index: 'problem', query: { match_all: {} } }); } catch (e) { if (!e.message.includes('index_not_found_exception')) throw e;