@@ -231,6 +231,7 @@ type FTAggregateApply struct {
231
231
232
232
type FTAggregateLoad struct {
233
233
Field string
234
+ As string
234
235
}
235
236
236
237
type FTAggregateWithCursor struct {
@@ -497,9 +498,16 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
497
498
}
498
499
if options .Load != nil {
499
500
queryArgs = append (queryArgs , "LOAD" , len (options .Load ))
501
+ index , count := len (queryArgs )- 1 , 0
500
502
for _ , load := range options .Load {
501
503
queryArgs = append (queryArgs , load .Field )
504
+ count ++
505
+ if load .As != "" {
506
+ queryArgs = append (queryArgs , "AS" , load .As )
507
+ count += 2
508
+ }
502
509
}
510
+ queryArgs [index ] = count
503
511
}
504
512
if options .Timeout > 0 {
505
513
queryArgs = append (queryArgs , "TIMEOUT" , options .Timeout )
@@ -684,9 +692,16 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
684
692
}
685
693
if options .Load != nil {
686
694
args = append (args , "LOAD" , len (options .Load ))
695
+ index , count := len (args )- 1 , 0
687
696
for _ , load := range options .Load {
688
697
args = append (args , load .Field )
698
+ count ++
699
+ if load .As != "" {
700
+ args = append (args , "AS" , load .As )
701
+ count += 2
702
+ }
689
703
}
704
+ args [index ] = count
690
705
}
691
706
if options .Timeout > 0 {
692
707
args = append (args , "TIMEOUT" , options .Timeout )
0 commit comments