@@ -33,7 +33,11 @@ type Client struct {
3333// openSearchProjectClient is the official OpenSearch client to wrap. Use NewOpenSearchProjectClient to create it.
3434// updateMaxRetries is the number of retries for update requests.
3535// updateRetryDelay is the delay between retries.
36- func NewClient (openSearchProjectClient * opensearchapi.Client , updateMaxRetries int , updateRetryDelay time.Duration ) * Client {
36+ func NewClient (
37+ openSearchProjectClient * opensearchapi.Client ,
38+ updateMaxRetries int ,
39+ updateRetryDelay time.Duration ,
40+ ) * Client {
3741 c := & Client {
3842 openSearchProjectClient : openSearchProjectClient ,
3943 }
@@ -107,7 +111,12 @@ func (c *Client) Count(indexName string, requestBody []byte) (count int64, err e
107111 return countResp .Count , nil
108112}
109113
110- func (c * Client ) SearchStream (indexName string , requestBody []byte , scrollTimeout time.Duration , ctx context.Context ) (io.Reader , error ) {
114+ func (c * Client ) SearchStream (
115+ indexName string ,
116+ requestBody []byte ,
117+ scrollTimeout time.Duration ,
118+ ctx context.Context ,
119+ ) (io.Reader , error ) {
111120 reader , writer := io .Pipe ()
112121 startSignal := make (chan error , 1 )
113122
@@ -208,7 +217,7 @@ func (c *Client) SearchStream(indexName string, requestBody []byte, scrollTimeou
208217 clearScrollReq := opensearchapi.ScrollDeleteReq {
209218 ScrollIDs : []string {scrollID },
210219 }
211- _ , err = c .openSearchProjectClient .Scroll .Delete (context . Background () , clearScrollReq )
220+ _ , err = c .openSearchProjectClient .Scroll .Delete (ctx , clearScrollReq )
212221 if err != nil {
213222 log .Warn ().Err (err ).Msgf ("failed to delete scroll context" )
214223 }
0 commit comments