Laravel redis implimentation

50 views
Skip to first unread message

Bakkesh AS

unread,
Nov 30, 2023, 9:16:30 AM11/30/23
to Redis DB

Hi, 

I want to execute the below redis query in laravel. Can any one please let me know how we can achive this ?

FT.AGGREGATE leads:index "@createdAt:[1638300000 1638400000]" GROUPBY 1 @leadBy REDUCE COUNT_DISTINCT 1 @leadId AS performance_count

I tried like below code, but getting error as "Command RAWCOMMAND is not a registered Redis command."

use Illuminate\Support\Facades\Redis; 
 
class CommonController extends BaseController { 

    public function checkRedisWorking(){ 
          $query = 'FT.AGGREGATE leads:index "@createdAt:[1638200000 1638400000]"            GROUPBY 1 @leadBy REDUCE COUNT_DISTINCT 1 @leadId AS performance_count';

          $result = Redis::rawCommand('FT.AGGREGATE', 'leads:index', $query); 
           result var_dump($result); 
     }
 } 

Thanks and Regards,
Bakkesh A S
Reply all
Reply to author
Forward
0 new messages