
Security News
TC39 Advances Temporal to Stage 4 Alongside Several ECMAScript Proposals
TC39’s March 2026 meeting advanced eight ECMAScript proposals, including Temporal reaching Stage 4 and securing its place in the ECMAScript 2026 specification.
@redis/search
Advanced tools
This package provides support for the [RediSearch](https://redis.io/docs/interact/search-and-query/) module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the [RedisJSON](https://redis.io/docs/data-type
This package provides support for the RediSearch module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the RedisJSON module.
Should be used with redis/@redis/client.
:warning: To use these extra commands, your Redis server must have the RediSearch module installed. To index and query JSON documents, you'll also need to add the RedisJSON module.
For complete examples, see search-hashes.js and search-json.js in the examples folder.
Before we can perform any searches, we need to tell RediSearch how to index our data, and which Redis keys to find that data in. The FT.CREATE command creates a RediSearch index. Here's how to use it to create an index we'll call idx:animals where we want to index hashes containing name, species and age fields, and whose key names in Redis begin with the prefix noderedis:animals:
await client.ft.create('idx:animals', {
name: {
type: SCHEMA_FIELD_TYPE.TEXT,
SORTABLE: true
},
species: SCHEMA_FIELD_TYPE.TAG,
age: SCHEMA_FIELD_TYPE.NUMERIC
}, {
ON: 'HASH',
PREFIX: 'noderedis:animals'
});
See the FT.CREATE documentation for information about the different field types and additional options.
You can index the same field multiple times with different types or aliases by using an array:
await client.ft.create('idx:products', {
sku: [
{ type: SCHEMA_FIELD_TYPE.TEXT, AS: 'sku_text' },
{ type: SCHEMA_FIELD_TYPE.TAG, AS: 'sku_tag', SORTABLE: true }
]
}, {
ON: 'HASH',
PREFIX: 'product:'
});
This allows querying the same field using different search strategies.
Once we've created an index, and added some data to Redis hashes whose keys begin with the prefix noderedis:animals, we can start writing some search queries. RediSearch supports a rich query syntax for full-text search, faceted search, aggregation and more. Check out the FT.SEARCH documentation and the query syntax reference for more information.
Let's write a query to find all the animals where the species field has the value dog:
const results = await client.ft.search('idx:animals', '@species:{dog}');
results looks like this:
{
total: 2,
documents: [
{
id: 'noderedis:animals:4',
value: {
name: 'Fido',
species: 'dog',
age: '7'
}
},
{
id: 'noderedis:animals:3',
value: {
name: 'Rover',
species: 'dog',
age: '9'
}
}
]
}
RediSearch can also index and query JSON documents stored in Redis using the RedisJSON module. The approach is similar to that for indexing and searching data in hashes, but we can now use JSON Path like syntax and the data no longer has to be flat name/value pairs - it can contain nested objects and arrays.
As before, we create an index with the FT.CREATE command, this time specifying we want to index JSON documents that look like this:
{
name: 'Alice',
age: 32,
coins: 100
}
Each document represents a user in some system, and users have name, age and coins properties.
One way we might choose to index these documents is as follows:
await client.ft.create('idx:users', {
'$.name': {
type: SCHEMA_FIELD_TYPE.TEXT,
SORTABLE: 'UNF'
},
'$.age': {
type: SCHEMA_FIELD_TYPE.NUMERIC,
AS: 'age'
},
'$.coins': {
type: SCHEMA_FIELD_TYPE.NUMERIC,
AS: 'coins'
}
}, {
ON: 'JSON',
PREFIX: 'noderedis:users'
});
Note that we're using JSON Path to specify where the fields to index are in our JSON documents, and the AS clause to define a name/alias for each field. We'll use these when writing queries.
Now we have an index and some data stored as JSON documents in Redis (see the JSON package documentation for examples of how to store JSON), we can write some queries...
We'll use the RediSearch query language and FT.SEARCH command. Here's a query to find users under the age of 30:
await client.ft.search('idx:users', '@age:[0 30]');
Redis OM provides an object mapping solution for Redis, including support for indexing and searching objects. While it offers similar search capabilities, @redis/search is more focused on leveraging the RediSearch module directly for advanced search features.
Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a broad set of use cases. While not a Redis-based solution, it offers comprehensive full-text search capabilities similar to those of @redis/search but is designed for use cases requiring distributed search capabilities across large datasets.
FAQs
This package provides support for the [RediSearch](https://redis.io/docs/interact/search-and-query/) module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the [RedisJSON](https://redis.io/docs/data-type
The npm package @redis/search receives a total of 4,087,755 weekly downloads. As such, @redis/search popularity was classified as popular.
We found that @redis/search demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
TC39’s March 2026 meeting advanced eight ECMAScript proposals, including Temporal reaching Stage 4 and securing its place in the ECMAScript 2026 specification.

Research
/Security News
Since January 31, 2026, we identified at least 72 additional malicious Open VSX extensions, including transitive GlassWorm loader extensions targeting developers.

Research
Six malicious Packagist packages posing as OphimCMS themes contain trojanized jQuery that exfiltrates URLs, injects ads, and loads FUNNULL-linked redirects.