qdrant / qdrant/qdrant

When the length of the multi-vector is one, it cannot be sent to the cloud Qdrant, but it is available locally, which is very confusing

Open
#5,394 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
34.7k
Forks
2.7k
Avg merge
1d 18h
Merged PRs (30d)
187

Description

Current Behavior

client:QdrantClient = QdrantClient(
url=URL,
port=6333,
api_key=API_KEY,
)

client = QdrantClient(

path="QdrantDB"

)

Behavior: After completing the local testing demo, I attempted to migrate to the cloud and modified the code as shown above. However, I encountered a strange issue: {"status":{"error":"Wrong input: Conversion between multi and regular vectors failed"},"time":0.002517693}. Since the local testing was already successful, this error confuses me. I am using Python.

Steps to Reproduce

query = ["apple"]
vector = encoder.encode(query).tolist()

get a vector like [[0.1, 0.2.....]] because the query is a list
then struct the point

point = models.PointStruct(
                id=1, 
                vector=vector,
                payload={
                    "tags": query,
                    "hash": "1234567890abcdef1111"
                }
            )

upload the point to the cloud
rep = client.upload_points(
collection_name=collection_name,
wait=True,
points=[point]
)
then we get the message:
{"status":{"error":"Wrong input: Conversion between multi and regular vectors failed"},"time":0.002517693}.

Expected Behavior

the point should be upload

Possible Solution

Fix the code to ensure consistent results between local and cloud environments in Python, avoiding potential issues during migration.

Context (Environment)

windows
python
drant_client

Detailed Description

Possible Implementation

from qdrant_client import models, QdrantClient
from sentence_transformers import SentenceTransformer
import time

encoder = SentenceTransformer("all-MiniLM-L6-v2")
documents = [
{"tags": ["#USA #California #LosAngeles"], "hash": "a1b2c3d4e5f67890"},
]

please attention the tags is a list

client = QdrantClient(url=URL, port=6333, api_key=API_KEY) # error

# client = QdrantClient(path="QdrantDB")  # success

def upload_points():
"""Uploads data points to the specified collection in Qdrant."""
try:
if not client.collection_exists(COLLECTION_NAME):
print("Creating collection...")
client.create_collection(
collection_name=COLLECTION_NAME,
vectors_config=models.VectorParams(
size=encoder.get_sentence_embedding_dimension(), # Vector size determined by model
distance=models.Distance.COSINE,
),
)

    print("Uploading data...")
    points = [
        models.PointStruct(
            id=idx,
            vector=encoder.encode(doc["tags"]).tolist(), # vector is like [[]]
            payload=doc
        )
        for idx, doc in enumerate(documents)
    ]
    

    # Perform the upsert operation
    response = client.upsert(
        collection_name=COLLECTION_NAME,
        wait=True,
        points=points
    )
    print("Upload response:", response)

except Exception as e:
    print(f"Error during upload_points: {e}")

def hits(query):
"""Retrieves the closest points to a given query."""
try:
query_vector = encoder.encode(query).tolist()
results = client.query_points(
collection_name=COLLECTION_NAME,
query=query_vector,
limit=3,
).points

    for result in results:
        print("Payload:", result.payload, "Score:", result.score)

except Exception as e:
    print(f"Error during hits retrieval: {e}")

this is my test function, ignore this

def encode_query(query):
"""Encodes a query into a vector and uploads it as a single point."""
try:
vector = encoder.encode(query).tolist()
point = models.PointStruct(
id=1,
vector=vector,
payload={
"tags": query,
"hash": "1234567890abcdef1111"
}
)

    response = client.upload_points(
        collection_name=COLLECTION_NAME,
        wait=True,
        points=[point]
    )
    print("Upload response for single point:", response)

except Exception as e:
    print(f"Error during encode_query: {e}")

if name == "main":
print("Starting upload...")
upload_points()
print(f"Currently {len(documents)} documents are uploaded.")

while True:
    user_input = input("Enter your query: ")
    if user_input.lower() == 'exit':
        print("Exiting program.")
        break
    hits(user_input)

Changes Made:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the QdrantClient collection setup and the PointStruct calls in upload_points, encode_query, and hits. Reproduce the difference between local and cloud clients using encoder.encode(...).tolist() and the shown vectors_config, then trace how upload_points and upsert handle the single-item nested vector. Done means the documented Python input behaves consistently in both environments and the point uploads successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.