Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client recreate_collection time out #308

Open
lw3259111 opened this issue Sep 21, 2023 · 8 comments
Open

client recreate_collection time out #308

lw3259111 opened this issue Sep 21, 2023 · 8 comments

Comments

@lw3259111
Copy link

I build qdrant with the follow step:

1. docker pull qdrant/qdrant
2. docker run -p 6333:6333 \
    -v $(pwd)/qdrant_storage:/qdrant/storage:z \
    qdrant/qdrant

I use qdrant with the follow step:

pip install qdrant-client==1.5.4
from qdrant_client import QdrantClient
from qdrant_client.http.models import Distance, VectorParams
client = QdrantClient("http://xxx.xxx.xxx.xxx", port=6333)
client.recreate_collection(
    collection_name="test_collection",
    vectors_config=VectorParams(size=4, distance=Distance.DOT),
)

The error is
image

@lw3259111 lw3259111 changed the title search time out client recreate_collection time out Sep 21, 2023
@joein
Copy link
Member

joein commented Sep 21, 2023

Hello @lw3259111
Have you tried to reproduce it locally?
(E.g. create a docker instance on your machine and try the very same thing)

@lw3259111
Copy link
Author

create a docker instance on your machine and try the very same thing

@joein It is work when I reproduce it locally,and the URL is work
image

@joein
Copy link
Member

joein commented Sep 21, 2023

It seems like problems with the resources (e.g. network)
However you can try to increase timeout during client instantiating and sending request

@lw3259111
Copy link
Author

It seems like problems with the resources (e.g. network) However you can try to increase timeout during client instantiating and sending request

Timeout to 60s is still failed. when I use rust is work.

rust code is

use anyhow::Result;
use qdrant_client::prelude::*;
use qdrant_client::qdrant::vectors_config::Config;
use qdrant_client::qdrant::{
    Condition, CreateCollection, Filter, SearchPoints, VectorParams, VectorsConfig,
};
use serde_json::json;

#[tokio::main]
async fn main() -> Result<()> {
    // Example of top level client
    // You may also use tonic-generated client from `src/qdrant.rs`
    let client = QdrantClient::from_url("http://192.168.99.100:6334").build()?;

    let collections_list = client.list_collections().await?;
    dbg!(collections_list);
    // collections_list = ListCollectionsResponse {
    //     collections: [
    //         CollectionDescription {
    //             name: "test",
    //         },
    //     ],
    //     time: 1.78e-6,
    // }

    let collection_name = "test";
    client.delete_collection(collection_name).await?;

    client
        .create_collection(&CreateCollection {
            collection_name: collection_name.into(),
            vectors_config: Some(VectorsConfig {
                config: Some(Config::Params(VectorParams {
                    size: 10,
                    distance: Distance::Cosine.into(),
                    ..Default::default()
                })),
            }),
            ..Default::default()
        })
        .await?;

    let collection_info = client.collection_info(collection_name).await?;
    dbg!(collection_info);

    let payload: Payload = json!(
        {
            "foo": "Bar",
            "bar": 12,
            "baz": {
                "qux": "quux"
            }
        }
    )
        .try_into()
        .unwrap();

    let points = vec![PointStruct::new(0, vec![12.; 10], payload)];
    client
        .upsert_points_blocking(collection_name, points, None)
        .await?;

    let search_result = client
        .search_points(&SearchPoints {
            collection_name: collection_name.into(),
            vector: vec![11.; 10],
            filter: Some(Filter::all([Condition::matches("bar", 12)])),
            limit: 10,
            with_payload: Some(true.into()),
            ..Default::default()
        })
        .await?;
    dbg!(&search_result);
    // search_result = SearchResponse {
    //     result: [
    //         ScoredPoint {
    //             id: Some(
    //                 PointId {
    //                     point_id_options: Some(
    //                         Num(
    //                             0,
    //                         ),
    //                     ),
    //                 },
    //             ),
    //             payload: {
    //                 "bar": Value {
    //                     kind: Some(
    //                         IntegerValue(
    //                     12,
    //                     ),
    //                     ),
    //                 },
    //                 "foo": Value {
    //                     kind: Some(
    //                         StringValue(
    //                     "Bar",
    //                     ),
    //                     ),
    //                 },
    //             },
    //             score: 1.0000001,
    //             version: 0,
    //             vectors: None,
    //         },
    //     ],
    //     time: 9.5394e-5,
    // }

    let found_point = search_result.result.into_iter().next().unwrap();
    let mut payload = found_point.payload;
    let baz_payload = payload.remove("baz").unwrap().into_json();
    println!("baz: {}", baz_payload);
    // baz: {"qux":"quux"}

    Ok(())
}

@joein
Copy link
Member

joein commented Sep 22, 2023

Have you tried to launch python code several times?
Tbh, it is hardly reproducible on our side and I haven't yet had any luck with that

@joein
Copy link
Member

joein commented Sep 22, 2023

Could you provide some exhaustive information / distinguishable details about your setup?

@Bannerli
Copy link

I have the same issue.
How to resolve the visiting another IP error? localhost goes well.

@joein
Copy link
Member

joein commented Oct 13, 2023

@Bannerli hello, could you provide some exhaustive information / distinguishable details about your setup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants