@@ -231,6 +231,7 @@ type FTAggregateApply struct {
231231
232232type FTAggregateLoad struct {
233233 Field string
234+ As string
234235}
235236
236237type FTAggregateWithCursor struct {
@@ -497,9 +498,16 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
497498 }
498499 if options .Load != nil {
499500 queryArgs = append (queryArgs , "LOAD" , len (options .Load ))
501+ index , count := len (queryArgs )- 1 , 0
500502 for _ , load := range options .Load {
501503 queryArgs = append (queryArgs , load .Field )
504+ count ++
505+ if load .As != "" {
506+ queryArgs = append (queryArgs , "AS" , load .As )
507+ count += 2
508+ }
502509 }
510+ queryArgs [index ] = count
503511 }
504512 if options .Timeout > 0 {
505513 queryArgs = append (queryArgs , "TIMEOUT" , options .Timeout )
@@ -684,9 +692,16 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
684692 }
685693 if options .Load != nil {
686694 args = append (args , "LOAD" , len (options .Load ))
695+ index , count := len (args )- 1 , 0
687696 for _ , load := range options .Load {
688697 args = append (args , load .Field )
698+ count ++
699+ if load .As != "" {
700+ args = append (args , "AS" , load .As )
701+ count += 2
702+ }
689703 }
704+ args [index ] = count
690705 }
691706 if options .Timeout > 0 {
692707 args = append (args , "TIMEOUT" , options .Timeout )
0 commit comments