HYBRIDfields are indexed for both full-text and semantic search.- Retrievers run the searches.
$annruns a semantic search, and$rrfmerges the results of several retrievers into one list.
Hybrid fields
AHYBRID field is a TEXT field that also stores a vector embedding. Full-text queries work on it
the same way as on a TEXT field, and $ann searches its embeddings by meaning. See
Hybrid Fields for the field options.
- An index can have more than one
HYBRIDfield. - If the text of a document cannot be embedded, the document is still searchable by its text.
HYBRIDfields work with JSON, hash, string, and stream indexes.
Create an index
Declare the fields you want to search by meaning asHYBRID:
- Redis CLI
Add documents
Write documents as usual. Search indexes them and creates their embeddings:- Redis CLI
Search by meaning
Use$ann to find the documents that are closest in meaning to a
text. This query can find the earplugs, even though their description does not contain the word
“noise”:
- Redis CLI
Combine full-text and semantic search
Use$rrf to run a full-text query and a semantic search, and merge
their results into one list. Documents that rank high in both come first:
- Redis CLI
$standard:
- Redis CLI
Next steps
- See Retrievers for all retriever parameters and rules.
- See Schema Definition for field types and options.
- See
SEARCH.QUERYfor all query options.