--- title: "Get started with Vector Database" description: "Create a Qdrant vector database on TIR, connect to it from Python, and run your first similarity search." content_type: "get-started" product: "vector-database" platform: "TIR" url: "/tir/vector-database/get-started/" --- # Get started with Vector Database Create a Qdrant vector database, connect to it from Python, and run your first similarity search. ## Before you begin You need a TIR project in Delhi or Chennai, enough credit to launch the nodes, and Python 3.8 or later for the client. An [instance](/tir/tir-instance/) in the project can run it. ## Create the database 1. In TIR, open your project. In the side menu, under **Storage**, select **Vector Database**. 2. Select **Create Database**. For a project's first database, the button reads **Launch Database**. 3. Keep the **Cluster Name** TIR fills in, or type your own. 4. In **Default Collection**, keep **Cosine** for **Distance**, and set **Vector Dimension** to the size of the vectors you will store. Keep **Shard Number** at 1 and **Replication Factor** at 3. 5. Under **Select Plan**, keep **E2E Cluster** and choose a plan. Keep **Node Count** at 3. 6. Select **Launch**. The database appears in the list as **Deploying** and becomes **Running** after a few minutes. See [Create a vector database](/tir/vector-database/how-to/create-a-vector-database/) for what each choice means. ## Get the connection details When the database is **Running**, select its row and open **Overview**. Copy the **Endpoint URL**, then show and copy the **API Key**. ## Connect and run a search Install the Python client: ```bash pip install qdrant-client ``` The script connects, creates a second collection with the same settings as the default one (**Cosine** distance, one shard, replication factor 3), and adds six points. It then searches for the three points nearest to a query vector. Replace `` with the **Endpoint URL** you copied, leaving off the `https://` at the start, and `` with the **API Key**. ```python from qdrant_client import QdrantClient from qdrant_client.http.models import Distance, VectorParams, PointStruct client = QdrantClient(host="", port=6333, https=True, api_key="") client.create_collection( collection_name="my_first_collection", vectors_config=VectorParams(size=4, distance=Distance.COSINE), shard_number=1, replication_factor=3, ) points = [ PointStruct(id=1, vector=[0.05, 0.61, 0.76, 0.74], payload={"city": "Berlin"}), PointStruct(id=2, vector=[0.19, 0.81, 0.75, 0.11], payload={"city": "London"}), PointStruct(id=3, vector=[0.36, 0.55, 0.47, 0.94], payload={"city": "Moscow"}), PointStruct(id=4, vector=[0.18, 0.01, 0.85, 0.80], payload={"city": "New York"}), PointStruct(id=5, vector=[0.24, 0.18, 0.22, 0.44], payload={"city": "Beijing"}), PointStruct(id=6, vector=[0.35, 0.08, 0.11, 0.44], payload={"city": "Chennai"}), ] client.upsert(collection_name="my_first_collection", points=points, wait=True) results = client.search( collection_name="my_first_collection", query_vector=[0.2, 0.1, 0.9, 0.7], limit=3, ) for point in results: print(f"ID: {point.id}, City: {point.payload['city']}, Score: {point.score}") ``` The script prints three lines, one for each of the nearest points, with their scores. To use gRPC instead of REST, connect on port 6334 with the gRPC option turned on: ```python client = QdrantClient( host="", port=6334, https=True, api_key="", prefer_grpc=True ) ``` ## What to do next - [Connect to a vector database](/tir/vector-database/how-to/connect-to-a-vector-database/) covers the keys, the Qdrant dashboard and the sample commands in the portal. - [Take a snapshot](/tir/vector-database/how-to/take-a-snapshot/) before you scale or change a lot of data. - [Stop or start the database](/tir/vector-database/how-to/stop-or-start-a-vector-database/) to pause its compute charge, and [delete it](/tir/vector-database/how-to/delete-a-vector-database/) to stop every charge. - For the Qdrant documentation, see [qdrant.tech](https://qdrant.tech/documentation/). For help with any message, see [Troubleshooting Vector Database](/tir/vector-database/troubleshooting/vector-database/).