To utilize ft.aggregate method in node-redis, follow these steps:
const redis = require('redis');
const client = redis.createClient();
client.ft_aggregate(index, query [, options], [callback]);
For example, to aggregate a search query for documents containing the term "apple" in the "fruit" field:
client.ft_aggregate('myIndex', 'apple', { APPLY: ['@fruit'] }, function(err, results) {
if (err) {
throw err;
}
console.log(results);
});
Here, the APPLY option is used to specify the fields to include in the aggregate results.
client.quit();
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-06-20 11:00:00 +0000
Seen: 10 times
Last updated: Nov 24 '22