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 }