From 46e3329e400e1e7f35e181e2ab924b4f1afaa57c Mon Sep 17 00:00:00 2001 From: lucas Date: Wed, 31 Dec 2025 15:46:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=20=E5=8F=96=E6=B6=88=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E6=9F=A5=E8=AF=A2=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consumers/consumerAXYThemeToES.go | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/consumers/consumerAXYThemeToES.go b/consumers/consumerAXYThemeToES.go index 2534f86..e7a1cf6 100644 --- a/consumers/consumerAXYThemeToES.go +++ b/consumers/consumerAXYThemeToES.go @@ -65,8 +65,7 @@ func (the *consumerAXYThemeToES) inputInitial() error { } the.InKafka.Initial() - structIds := the.Info.IoConfig.Out.Es.Index - queryStr := the.getESTimeQueryStr(structIds) + queryStr := the.getESTimeQueryStr() index := the.Info.IoConfig.Out.Es.Index sensorIdArray, _ = the.OutEs.SearchThemeDataArray(index, queryStr) @@ -219,8 +218,7 @@ func (the *consumerAXYThemeToES) judgeTime(rawMsg string) (time.Time, time.Time, } else { acqTime := theme.AcqTime - structIds := the.Info.IoConfig.Out.Es.Index - queryStr := the.getESTimeQueryStr(structIds) + queryStr := the.getESTimeQueryStr() index := the.Info.IoConfig.Out.Es.Index sensorIdArray, _ = the.OutEs.SearchThemeDataArray(index, queryStr) @@ -234,24 +232,22 @@ func (the *consumerAXYThemeToES) judgeTime(rawMsg string) (time.Time, time.Time, } } -func (the *consumerAXYThemeToES) getESTimeQueryStr(structId string) string { +func (the *consumerAXYThemeToES) getESTimeQueryStr() string { esQuery := fmt.Sprintf(` { - "query": { - "bool": { - "must": [ - { - "term": { - "structure": { - "value": %s - } - } - } - ] + "size": 10000, + "sort": [ + { + "create_time": { + "order": "desc" + } } + ], + "query": { + "match_all": {} } } -`, structId) +`) return esQuery }