@@ -180,12 +180,12 @@ stack_path: docs/interact/search-and-query
180180summary : Run a search query on an index and perform aggregate transformations on the
181181 results
182182syntax : " FT.AGGREGATE index query \n [VERBATIM] \n [LOAD count field [field ...]]\
183- \ \n [TIMEOUT timeout] \n [ GROUPBY nargs property [property ...] [ REDUCE function\
184- \ nargs arg [arg ...] [AS name] [ REDUCE function nargs arg [arg ...] [AS name]\
185- \ ...]] ...]] \n [ SORTBY nargs [ property ASC | DESC [ property ASC | DESC ...]]\
186- \ [MAX num] [WITHCOUNT] \n [ APPLY expression AS name [ APPLY expression AS name\
187- \ ...]] \n [ LIMIT offset num] \n [FILTER filter] \n [ WITHCURSOR [COUNT read_size]\
188- \ [MAXIDLE idle_time]] \n [ PARAMS nargs name value [ name value ...]] \n [SCORER scorer]\n
183+ \ \n [TIMEOUT timeout] \n [GROUPBY nargs property [property ...] [REDUCE function\
184+ \ nargs arg [arg ...] [AS name] [REDUCE function nargs arg [arg ...] [AS name]\
185+ \ ...]] ...]] \n [SORTBY nargs [property ASC | DESC [property ASC | DESC ...]]\
186+ \ [MAX num] [WITHCOUNT] \n [APPLY expression AS name [APPLY expression AS name\
187+ \ ...]] \n [LIMIT offset num] \n [FILTER filter] \n [WITHCURSOR [COUNT read_size]\
188+ \ [MAXIDLE idle_time]] \n [PARAMS nargs name value [name value ...]] \n [SCORER scorer]\n
189189 \ [ADDSCORES] \n [DIALECT\
190190 \ dialect]\n "
191191syntax_fmt : " FT.AGGREGATE index query [VERBATIM] [LOAD\_ count field [field ...]]\n \
@@ -402,7 +402,7 @@ FT.AGGREGATE idx "@url:\"about.html\""
402402 GROUPBY 2 @day @country
403403 REDUCE count 0 AS num_visits
404404 SORTBY 4 @day
405- {{< / highlight >}}
405+ {{< /highlight >}}
406406</details >
407407
408408<details open >
@@ -416,7 +416,7 @@ FT.AGGREGATE books-idx *
416416 REDUCE COUNT 0 AS num_published
417417 GROUPBY 0
418418 REDUCE MAX 1 @num_published AS max_books_published_per_year
419- {{< / highlight >}}
419+ {{< /highlight >}}
420420</details >
421421
422422<details open >
@@ -430,7 +430,7 @@ Search for libraries within 10 kilometers of the longitude -73.982254 and latitu
430430 FT.AGGREGATE libraries-idx "@location :[ -73.982254 40.753181 10 km] "
431431 LOAD 1 @location
432432 APPLY "geodistance(@location , -73.982254, 40.753181)"
433- {{< / highlight >}}
433+ {{< /highlight >}}
434434
435435Here, notice the required use of ` LOAD ` to pre-load the ` @location ` attribute because it is a GEO attribute.
436436
@@ -480,7 +480,7 @@ Next, count GitHub events by user (actor), to produce the most active users.
480480 3 ) "num"
481481 4 ) "2794"
482482(0.59s)
483- {{< / highlight >}}
483+ {{< /highlight >}}
484484
485485</details >
486486
@@ -502,17 +502,18 @@ FT.AGGREGATE orders "*"
502502APPLY case(@status == "pending", 1, 0) AS is_pending
503503APPLY case(@is_pending == 1 && @priority == "high", 1,2) AS status_high
504504APPLY case(@is_pending == 0 && @priority == "high", 3,4) AS status_completed
505- {{< / highlight >}}
505+ {{< /highlight >}}
506506
507507</details >
508+
508509## Return information
509510
510511{{< multitabs id="ft-aggregate-return-info"
511512 tab1="RESP2"
512513 tab2="RESP3" >}}
513514
514515One of the following:
515- * [ Array] ({{< relref "/develop/reference/protocol-spec#arrays" >}}) with the first element being the total number of results, followed by result rows as [ arrays ] ({{< relref "/ develop/reference/protocol-spec#arrays " >}}) of field-value pairs .
516+ * [ Array reply ] ({{< relref "/develop/reference/protocol-spec#arrays" >}}) where each row is an array reply representing a single aggregate result. The [ integer reply ] ({{< relref "develop/reference/protocol-spec#resp-integers " >}}) at position ` 1 ` does not represent a valid value .
516517* [ Simple error reply] ({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existent index, invalid query syntax.
517518
518519-tab-sep-
0 commit comments