@@ -341,11 +341,7 @@ func (ei *elasticProcessor) RemoveTransactions(header coreData.HeaderHandler, bo
341341 return err
342342 }
343343
344- timestamp := header .GetTimeStamp ()
345- if timestampMs > 0 {
346- timestamp = timestampMs
347- }
348- err = ei .removeFromIndexByTimestampAndShardID (timestamp , header .GetShardID (), elasticIndexer .EventsIndex )
344+ err = ei .removeFromIndexByTimestampAndShardID (header .GetShardID (), elasticIndexer .EventsIndex , timestampMs )
349345 if err != nil {
350346 return err
351347 }
@@ -382,23 +378,18 @@ func (ei *elasticProcessor) removeIfHashesNotEmpty(index string, hashes []string
382378}
383379
384380// RemoveAccountsESDT will remove data from accountsesdt index and accountsesdthistory
385- func (ei * elasticProcessor ) RemoveAccountsESDT (headerTimestamp uint64 , shardID uint32 , timestampMs uint64 ) error {
386- timestamp := headerTimestamp
387- if timestampMs > 0 {
388- timestamp = timestampMs
389- }
390-
391- err := ei .removeFromIndexByTimestampAndShardID (timestamp , shardID , elasticIndexer .AccountsESDTIndex )
381+ func (ei * elasticProcessor ) RemoveAccountsESDT (shardID uint32 , timestampMs uint64 ) error {
382+ err := ei .removeFromIndexByTimestampAndShardID (shardID , elasticIndexer .AccountsESDTIndex , timestampMs )
392383 if err != nil {
393384 return err
394385 }
395386
396- return ei .removeFromIndexByTimestampAndShardID (timestamp , shardID , elasticIndexer .AccountsESDTHistoryIndex )
387+ return ei .removeFromIndexByTimestampAndShardID (shardID , elasticIndexer .AccountsESDTHistoryIndex , timestampMs )
397388}
398389
399- func (ei * elasticProcessor ) removeFromIndexByTimestampAndShardID (headerTimestamp uint64 , shardID uint32 , index string ) error {
390+ func (ei * elasticProcessor ) removeFromIndexByTimestampAndShardID (shardID uint32 , index string , timestampMs uint64 ) error {
400391 ctxWithValue := context .WithValue (context .Background (), request .ContextKey , request .ExtendTopicWithShardID (request .RemoveTopic , shardID ))
401- query := fmt .Sprintf (`{"query": {"bool": {"must": [{"match": {"shardID": {"query": %d,"operator": "AND"}}},{"match": {"timestamp ": {"query": "%d","operator": "AND"}}}]}}}` , shardID , headerTimestamp )
392+ query := fmt .Sprintf (`{"query": {"bool": {"must": [{"match": {"shardID": {"query": %d,"operator": "AND"}}},{"match": {"timestampMs ": {"query": "%d","operator": "AND"}}}]}}}` , shardID , timestampMs )
402393
403394 return ei .elasticClient .DoQueryRemove (
404395 ctxWithValue ,
0 commit comments