Describe the bug

The RediSearch not come out correct result.

To reproduce

Server: 2 nodes with cluster enabled (Redis Enterprise)

My sample data in JSON:

[{"Key":"V10:L1:MG:221125-225247-56450-0039","TTL":1009752.7519,"DataToRedisList":[{"SerialNoType":4,"SerialNo":"NA","StationID":"RT190","DTProcessed":638229621126300000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT110_2","DTProcessed":638229622233700000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_1","DTProcessed":638229622449900000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_2","DTProcessed":638229622648700000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_1","DTProcessed":638229622773700000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_2","DTProcessed":638229622864000000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT140_1","DTProcessed":638229622972400000},{"SerialNoType":1,"SerialNo":"07106Y1309435063","StationID":"Unknown","DTProcessed":0}]},{"Key":"V10:L1:MG:221125-225247-56282-0039","TTL":1038162.7519,"DataToRedisList":[{"SerialNoType":4,"SerialNo":"NA","StationID":"RT190","DTProcessed":638229621410400000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT110_2","DTProcessed":638229622395900000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_1","DTProcessed":638229622630500000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_2","DTProcessed":638229622828200000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_1","DTProcessed":638229622954500000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_2","DTProcessed":638229623044600000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT140_1","DTProcessed":638229623152900000},{"SerialNoType":1,"SerialNo":"07106Y1309437557","StationID":"Unknown","DTProcessed":0}]},{"Key":"V10:L1:MG:221125-225247-56465-0039","TTL":1047132.7519,"DataToRedisList":[{"SerialNoType":4,"SerialNo":"NA","StationID":"RT190","DTProcessed":638229621500100000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT110_2","DTProcessed":638229622485700000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_1","DTProcessed":638229622719900000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_2","DTProcessed":638229622900400000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_1","DTProcessed":638229623044600000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_2","DTProcessed":638229623135100000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT140_1","DTProcessed":638229623243400000},{"SerialNoType":1,"SerialNo":"07106Y1309437562","StationID":"Unknown","DTProcessed":0}]},{"Key":"V10:L1:MG:221125-225247-56448-0039","TTL":1055992.7519,"DataToRedisList":[{"SerialNoType":4,"SerialNo":"NA","StationID":"RT190","DTProcessed":638229621588700000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT110_2","DTProcessed":638229622576200000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_1","DTProcessed":638229622809900000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT120_2","DTProcessed":638229622990600000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_1","DTProcessed":638229623135100000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT130_2","DTProcessed":638229623225600000},{"SerialNoType":4,"SerialNo":"NA","StationID":"RT140_1","DTProcessed":638229623333700000},{"SerialNoType":1,"SerialNo":"07106Y1309435176","StationID":"Unknown","DTProcessed":0}]}]

Run the command below:

Create index on StationID and DTProcessed

FT.CREATE v10l1Index3 ON JSON PREFIX 1 "V10:L1" SCHEMA $.DataToRedisList[].StationID AS StationID TEXT $.DataToRedisList[].DTProcessed AS DTProcessed NUMERIC

Count the total number of StationID

FT.AGGREGATE v10l1Index3 * GROUPBY 1 @StationID REDUCE COUNT 0 AS TotalCount SORTBY 2 @TotalCount DESC

Wrong result return: 1) "1" 2) 1) "StationID" 2) "RT190" 3) "TotalCount" 4) "2"

Expected behavior

The result should be like:

1) "1" 2) 1) "StationID" 2) "RT190" 3) "TotalCount" 4) "4" 3) 1) "StationID" 2) "RT110_2" 3) "TotalCount" 4) "4" 4) 1) "StationID" 2) "RT120_1" 3) "TotalCount" 4) "4" 5) 1) "StationID" 2) "RT120_2" 3) "TotalCount" 4) "4" 6) 1) "StationID" 2) "RT130_1" 3) "TotalCount" 4) "4" 7) 1) "StationID" 2) "RT130_2" 3) "TotalCount" 4) "4" 8) 1) "StationID" 2) "RT140_1" 3) "TotalCount" 4) "4"

Additional information

Not sure is the RediSearch bugs or my data format got issue.

Please help check, thanks a lot

Any additional information that is relevant to the problem.

Comment From: oranagra

please report in https://github.com/RediSearch/RediSearch

Comment From: JianpingAtGitHub

please report in https://github.com/RediSearch/RediSearch

Hi oranagra, have resubmit to RediSearch github

Thanks.