I want to execute the below Redis query in Laravel. Can anyone please let me know how we can achieve this?
FT.AGGREGATE leads:index "@createdAt:[1638300000 1638400000]"
GROUPBY 1 @leadBy
REDUCE COUNT_DISTINCT 1 @leadId AS performance_count
I tried like this, but I'm getting an error
Command
RAWCOMMANDis not a registered Redis command
Code:
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';
// Get the underlying Predis client
$result = Redis::rawCommand('FT.AGGREGATE', 'leads:index', $query);
// Display the result
var_dump($result);
}
}