Browse Source

feat:xiugai

wangchuanjin 10 months ago
parent
commit
401647f262
1 changed files with 6 additions and 4 deletions
  1. 6 4
      es/esv7.go

+ 6 - 4
es/esv7.go

@@ -1040,9 +1040,11 @@ func (e *EsV7) Scroll(indexName, scrollTime, query string, f func(fv map[string]
 		// 更新滚动服务以使用新的滚动 ID
 		scrollService = client.Scroll(indexName).ScrollId(scrollID).Scroll(scrollTime)
 	}
-	// 清理滚动上下文
-	_, err := client.ClearScroll().ScrollId(scrollID).Do(context.Background())
-	if err != nil {
-		log.Println(scrollID, "Error clearing scroll: ", err)
+	if scrollID != "" {
+		// 清理滚动上下文
+		_, err := client.ClearScroll().ScrollId(scrollID).Do(context.Background())
+		if err != nil {
+			log.Println(scrollID, "Error clearing scroll: ", err)
+		}
 	}
 }