From the course: LLM Foundations: Vector Databases for Caching and Retrieval Augmented Generation (RAG)
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Query scalar data
From the course: LLM Foundations: Vector Databases for Caching and Retrieval Augmented Generation (RAG)
Query scalar data
Now that we have the data inserted and indexed, we are ready to run some queries. We will start with querying scalar data. Scalar data querying is similar to how RDBMS queries work. We already discussed the query capabilities available in Milvus in the previous chapter. Let's now run some sample queries. Before any queries or search can be executed, the collection should be loaded into memory. To do that, we use the collections load method on the collection. Then we will execute a query that will fetch the title and description for course_id 1001. For this, we call the query method on the collection. We provide an expression that contains the filters for the query. The only filter we use here is the course_id. We then specify the output fields for the query in the output_fields parameter. We can then run the query and print the results. The output is a list of records. Each record is returned as a dictionary. We will then execute another query. This time we look at all the titles that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.