wangchuanjin 10 kuukautta sitten
vanhempi
commit
401647f262
1 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  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)
+		}
 	}
 }