Skip to content

how does llama index query the redis, KNN or Range, what command does it use? #15994

Answered by dosubot bot
johnhu33 asked this question in Q&A
Discussion options

You must be logged in to vote

LlamaIndex queries Redis using KNN (k-nearest neighbors). The command it uses is:

base_query = f"{filters}=>[KNN {top_k} @{vector_field} $vector AS vector_score]"

This command is part of the get_redis_query function, which constructs a vector query for use with a SearchIndex. LlamaIndex supports two types of vector indexes in Redis: FLAT (brute force search) and HNSW (hierarchical navigable small world graph index).

Additionally, LlamaIndex also supports querying using range filters. The _metadatafilter_to_dict function converts range filters into a dictionary format that can be used in the query. The _search_query_with_filter function constructs a search query with pre-filter or post-fi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johnhu33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant