Redis Time Series Issue

38 views Asked by At
  • Inside docker i have installed redis stack server and i am using nodejs express api to test redis time series command however it always throws an error **unknown command "TS.CREATE" or "TS.ADD" ** but inside redis-cli redis-timeseries works perfectly.

i also tried in php but same error unknown command

This is my nodejs code

app.get('/add', async function (req, res, next) {
try {
    const client = createClient()
    await client.connect()

    const created = await client.ts.create('temperature', {
        RETENTION: 86400000,
        ENCODING: TimeSeriesEncoding.UNCOMPRESSED,
        DUPLICATE_POLICY: TimeSeriesDuplicatePolicies.BLOCK,
    });

    if (created === 'OK') {
        console.log('Created timeseries.');
    } else {
        console.log('Error creating timeseries :(');
        process.exit(1);
    }
} catch (error) {
    next(error)
}

});

and this is my php code

both gives same error

0

There are 0 answers