1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use crate::qdrant::{
CreateFieldIndexCollection, DeleteFieldIndexCollection, PointsOperationResponse,
};
use crate::qdrant_client::{Qdrant, QdrantResult};
/// # Index operations
///
/// Manage field and payload indices in collections.
///
/// Documentation: <https://qdrant.tech/documentation/concepts/indexing/>
impl Qdrant {
/// Create payload index in a collection.
///
/// ```no_run
///# use std::collections::HashMap;
///# use qdrant_client::{Qdrant, QdrantError};
/// use qdrant_client::qdrant::{CreateFieldIndexCollectionBuilder, FieldType};
///
///# async fn create_field_index(client: &Qdrant)
///# -> Result<(), QdrantError> {
/// client
/// .create_field_index(
/// CreateFieldIndexCollectionBuilder::new(
/// "my_collection",
/// "city",
/// FieldType::Keyword,
/// ),
/// )
/// .await?;
///# Ok(())
///# }
/// ```
///
/// Documentation: <https://qdrant.tech/documentation/concepts/indexing/#payload-index>
pub async fn create_field_index(
&self,
request: impl Into<CreateFieldIndexCollection>,
) -> QdrantResult<PointsOperationResponse> {
let request = &request.into();
self.with_points_client(|mut client| async move {
let result = client.create_field_index(request.clone()).await?;
Ok(result.into_inner())
})
.await
}
/// Delete payload index from a collection.
///
/// ```no_run
///# use std::collections::HashMap;
///# use qdrant_client::{Qdrant, QdrantError};
/// use qdrant_client::qdrant::DeleteFieldIndexCollectionBuilder;
///
///# async fn create_field_index(client: &Qdrant)
///# -> Result<(), QdrantError> {
/// client
/// .delete_field_index(DeleteFieldIndexCollectionBuilder::new(
/// "my_collection",
/// "city",
/// ))
/// .await?;
///# Ok(())
///# }
/// ```
///
/// Documentation: <https://qdrant.tech/documentation/concepts/indexing/#payload-index>
pub async fn delete_field_index(
&self,
request: impl Into<DeleteFieldIndexCollection>,
) -> QdrantResult<PointsOperationResponse> {
let request = &request.into();
self.with_points_client(|mut client| async move {
let result = client.delete_field_index(request.clone()).await?;
Ok(result.into_inner())
})
.await
}
}