Package io.qdrant.client
Class QdrantClient
java.lang.Object
io.qdrant.client.QdrantClient
Client for interfacing with the Qdrant service.
-
Constructor Summary
ConstructorDescriptionQdrantClient
(String url) Constructs a new QdrantClient with the specified URL
Uses TLS if the URL is https, otherwise uses plaintext.QdrantClient
(String url, String apiKey) Constructs a new QdrantClient with the specified URL and API key
Uses TLS if the URL is https, otherwise uses plaintext. -
Method Summary
Modifier and TypeMethodDescriptionbatchUpdate
(String collectionName, List<Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Performs a batch update operation on a collection.batchUpdateBlocking
(String collectionName, List<Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Performs a batch update operation on a collection.clearPayload
(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Clears the payload associated with the specified collection, points and ordering.clearPayloadBlocking
(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Clears the payload associated with the specified collection, points and ordering.count
(Points.CountPoints request) Counts the number of points in a collection based on the given filters.count
(String collectionName, Points.Filter filter) Counts the number of points in a collection based on the given filters.createAlias
(String collectionName, String aliasName) Creates an alias for a collection.Creates a new collection with the specified details.createCollection
(String collectionName, long vectorSize, Collections.Distance distance) Creates a new collection with the specified name, vector size, and distance metric.createFieldIndex
(String collectionName, String fieldName, Points.FieldType fieldType, Collections.PayloadIndexParams fieldIndexParams, Points.WriteOrderingType ordering) Creates a field index in the specified collection with the given parameters.createFieldIndexBlocking
(String collectionName, String fieldName, Points.FieldType fieldType, Collections.PayloadIndexParams fieldIndexParams, Points.WriteOrderingType ordering) Creates a field index in the specified collection with the given parameters.Creates a full snapshot of the Qdrant database.createSnapshot
(String collectionName) Creates a snapshot of a collection.deleteAlias
(String aliasName) Deletes an alias with the specified name.deleteCollection
(String collectionName) Deletes a collection with the specified name.deleteFieldIndex
(String collectionName, String fieldName, Points.WriteOrderingType ordering) Deletes the field index for a given collection and field name.deleteFieldIndexBlocking
(String collectionName, String fieldName, Points.WriteOrderingType ordering) Deletes the field index for a given collection and field name.deleteFullSnapshot
(String snapshotName) Deletes a full snapshot.deletePayload
(String collectionName, Points.PointsSelector points, List<String> keys, Points.WriteOrderingType ordering) Deletes the payload associated with the specified collection, points, keys, and ordering.deletePayloadBlocking
(String collectionName, Points.PointsSelector points, List<String> keys, Points.WriteOrderingType ordering) Deletes the payload associated with the specified collection, points, keys, and ordering.deletePoints
(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Deletes points from a collection.deletePointsBlocking
(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Deletes points from a collection.deleteSnapshot
(String collectionName, String snapshotName) Deletes a snapshot with the specified name from the given collection.deleteVectors
(String collectionName, Points.PointsSelector points, Points.VectorsSelector vectors, Points.WriteOrderingType ordering) Deletes vectors from a collection.deleteVectorsBlocking
(String collectionName, Points.PointsSelector points, Points.VectorsSelector vectors, Points.WriteOrderingType ordering) Deletes vectors from a collection.getCollectionClusterInfo
(String collectionName) Retrieves the cluster information for a specific collection.getCollectionInfo
(String collectionName) Retrieves information about a collection.getPoints
(String collectionName, Iterable<? extends Points.PointId> points, Points.WithVectorsSelector withVectors, Points.WithPayloadSelector withPayload, Points.ReadConsistencyType readConsistency) Retrieves points from a collection.boolean
hasCollection
(String collectionName) Checks if a collection with the given name exists.Performs a health check on the Qdrant service.Retrieves a list of aliases.listCollectionAliases
(String collectionName) Retrieves the list of aliases for a given collection.Retrieves a list of collections.listFullSnapshots
(String collectionName) Retrieves a list of full snapshots for a given collection.listSnapshots
(String collectionName) Retrieves a list of snapshots for a given collection.overwritePayload
(String collectionName, Points.PointsSelector points, Map<String, JsonWithInt.Value> payload, Points.WriteOrderingType ordering) Overwrites the payload of the specified points in a collection.overwritePayloadBlocking
(String collectionName, Points.PointsSelector points, Map<String, JsonWithInt.Value> payload, Points.WriteOrderingType ordering) Overwrites the payload of the specified points in a collection.recommend
(Points.RecommendPoints request) Recommends points based on the given positive/negative points recommendation request.Recommends points batch based on the given positive/negative points recommendation request.Recommends groups based on the given positive/negative points recommendation request.Deletes and creates a new collection with the specified details.recreateCollection
(String collectionName, long vectorSize, Collections.Distance distance) Deletes and creates a new collection with the specified name, vector size, and distance metric.renameAlias
(String oldAliasName, String newAliasName) Renames an alias in the Qdrant collection.scroll
(Points.ScrollPoints request) Retrieve points from a collection based on filters.Performs a batch search for points.searchGroups
(Points.SearchPointGroups request) Searches for point groups based on the given request.searchPoints
(Points.SearchPoints request) Performs a search operation on the points.updateAliases
(Collections.ChangeAliases details) Updates the aliases for collections.updateBatchPoints
(String collecionName, Iterable<? extends Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Updates a batch of points in a collection.updateBatchPointsBlocking
(String collectionName, Iterable<? extends Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Updates a batch of points in a collection.Updates a collection with the specified details.updateCollectionClusterSetup
(String collectionName, Collections.UpdateCollectionClusterSetupRequest request) Updates the cluster setup for a collection.updateVectors
(String collectionName, Iterable<? extends Points.PointVectors> points, Points.WriteOrderingType ordering) Updates the vectors of points in a collection.updateVectorsBlocking
(String collectionName, Iterable<? extends Points.PointVectors> points, Points.WriteOrderingType ordering) Updates the vectors of points in a collection.upsertPoints
(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering) Upserts the given points into the specified collection.upsertPointsBatch
(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering, int chunkSize) Upserts a batch of points in the specified collection.upsertPointsBatchBlocking
(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering, int chunkSize) Upserts a batch of points in the specified collection.upsertPointsBlocking
(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering) Upserts the given points into the specified collection.
-
Constructor Details
-
QdrantClient
public QdrantClient(String url, String apiKey) throws MalformedURLException, IllegalArgumentException Constructs a new QdrantClient with the specified URL and API key
Uses TLS if the URL is https, otherwise uses plaintext.- Parameters:
url
- The URL of the Qdrant service.apiKey
- The API key for authentication.- Throws:
MalformedURLException
- If the URL is malformed.IllegalArgumentException
- If the protocol is invalid.
-
QdrantClient
Constructs a new QdrantClient with the specified URL
Uses TLS if the URL is https, otherwise uses plaintext.- Parameters:
url
- the URL of the Qdrant service- Throws:
MalformedURLException
- If the URL is malformedIllegalArgumentException
- If the protocol is invalid.
-
-
Method Details
-
listCollections
Retrieves a list of collections.- Returns:
- The response containing the list of collections.
-
healthCheck
Performs a health check on the Qdrant service.- Returns:
- The health check reply from the Qdrant service.
-
hasCollection
Checks if a collection with the given name exists.- Parameters:
collectionName
- The name of the collection to check.- Returns:
- True if the collection exists, false otherwise.
-
createCollection
public Collections.CollectionOperationResponse createCollection(String collectionName, long vectorSize, Collections.Distance distance) Creates a new collection with the specified name, vector size, and distance metric.- Parameters:
collectionName
- The name of the collection to be created.vectorSize
- The size of the vectors in the collection.distance
- The distance metric to be used for vector comparison.- Returns:
- The response containing the operation status.
-
createCollection
public Collections.CollectionOperationResponse createCollection(Collections.CreateCollection details) Creates a new collection with the specified details.- Parameters:
details
- The details of the collection to be created.- Returns:
- The response containing the operation status.
-
recreateCollection
public Collections.CollectionOperationResponse recreateCollection(String collectionName, long vectorSize, Collections.Distance distance) Deletes and creates a new collection with the specified name, vector size, and distance metric.- Parameters:
collectionName
- The name of the collection to be created.vectorSize
- The size of the vectors in the collection.distance
- The distance metric to be used for vector comparison.- Returns:
- The response containing the operation status.
-
recreateCollection
public Collections.CollectionOperationResponse recreateCollection(Collections.CreateCollection details) Deletes and creates a new collection with the specified details.- Parameters:
details
- The details of the collection to be created.- Returns:
- The response containing the operation status.
-
updateCollection
public Collections.CollectionOperationResponse updateCollection(Collections.UpdateCollection details) Updates a collection with the specified details.- Parameters:
details
- The details of the update operation.- Returns:
- The response containing the operation status.
-
deleteCollection
Deletes a collection with the specified name.- Parameters:
collectionName
- the name of the collection to be deleted- Returns:
- the response of the collection deletion operation
-
getCollectionInfo
Retrieves information about a collection.- Parameters:
collectionName
- The name of the collection.- Returns:
- The response containing the collection information.
-
createAlias
Creates an alias for a collection.- Parameters:
collectionName
- The name of the collection.aliasName
- The name of the alias.- Returns:
- The response of the collection operation.
-
deleteAlias
Deletes an alias with the specified name.- Parameters:
aliasName
- the name of the alias to be deleted- Returns:
- the response of the collection operation
-
renameAlias
public Collections.CollectionOperationResponse renameAlias(String oldAliasName, String newAliasName) Renames an alias in the Qdrant collection.- Parameters:
oldAliasName
- The current name of the alias.newAliasName
- The new name for the alias.- Returns:
- The response containing the result of the alias rename operation.
-
updateAliases
Updates the aliases for collections.- Parameters:
details
- The details of the aliases to be changed.- Returns:
- The response of the collection operation.
-
listCollectionAliases
Retrieves the list of aliases for a given collection.- Parameters:
collectionName
- The name of the collection.- Returns:
- The response containing the list of aliases.
-
listAliases
Retrieves a list of aliases.- Returns:
- The response containing the list of aliases.
-
getCollectionClusterInfo
Retrieves the cluster information for a specific collection.- Parameters:
collectionName
- The name of the collection.- Returns:
- The cluster information for the collection.
-
updateCollectionClusterSetup
public Collections.UpdateCollectionClusterSetupResponse updateCollectionClusterSetup(String collectionName, Collections.UpdateCollectionClusterSetupRequest request) Updates the cluster setup for a collection.- Parameters:
collectionName
- The name of the collection.request
- The request object containing the updated cluster setup.- Returns:
- The response object indicating the success or failure of the update operation.
-
batchUpdate
public Points.UpdateBatchResponse batchUpdate(String collectionName, List<Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Performs a batch update operation on a collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.operations
- The list of update operations to be performed.- Returns:
- The response of the batch update operation.
-
batchUpdateBlocking
public Points.UpdateBatchResponse batchUpdateBlocking(String collectionName, List<Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Performs a batch update operation on a collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.operations
- The list of update operations to be performed.- Returns:
- The response of the batch update operation.
-
upsertPoints
public Points.PointsOperationResponse upsertPoints(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering) Upserts the given points into the specified collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The list of points to be upserted.ordering
- The write ordering for the upsert operation.- Returns:
- The response of the upsert operation.
-
upsertPointsBlocking
public Points.PointsOperationResponse upsertPointsBlocking(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering) Upserts the given points into the specified collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The list of points to be upserted.ordering
- The write ordering for the upsert operation.- Returns:
- The response of the upsert operation.
-
upsertPointsBatch
public Points.PointsOperationResponse upsertPointsBatch(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering, int chunkSize) Upserts a batch of points in the specified collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The list of points to upsert.- Returns:
- The response of the points operation.
-
upsertPointsBatchBlocking
public Points.PointsOperationResponse upsertPointsBatchBlocking(String collectionName, List<Points.PointStruct> points, Points.WriteOrderingType ordering, int chunkSize) Upserts a batch of points in the specified collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The list of points to upsert.- Returns:
- The response of the points operation.
-
overwritePayload
public Points.PointsOperationResponse overwritePayload(String collectionName, Points.PointsSelector points, Map<String, JsonWithInt.Value> payload, Points.WriteOrderingType ordering) Overwrites the payload of the specified points in a collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The selector for the points to be overwritten.payload
- The new payload to be assigned to the points.ordering
- The ordering of the write operation.- Returns:
- The response of the points operation.
-
overwritePayloadBlocking
public Points.PointsOperationResponse overwritePayloadBlocking(String collectionName, Points.PointsSelector points, Map<String, JsonWithInt.Value> payload, Points.WriteOrderingType ordering) Overwrites the payload of the specified points in a collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The selector for the points to be overwritten.payload
- The new payload to be assigned to the points.ordering
- The ordering of the write operation.- Returns:
- The response of the points operation.
-
deletePayload
public Points.PointsOperationResponse deletePayload(String collectionName, Points.PointsSelector points, List<String> keys, Points.WriteOrderingType ordering) Deletes the payload associated with the specified collection, points, keys, and ordering. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The points selector.keys
- The list of keys.ordering
- The write ordering.- Returns:
- The response of the points operation.
-
deletePayloadBlocking
public Points.PointsOperationResponse deletePayloadBlocking(String collectionName, Points.PointsSelector points, List<String> keys, Points.WriteOrderingType ordering) Deletes the payload associated with the specified collection, points, keys, and ordering. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The points selector.keys
- The list of keys.ordering
- The write ordering.- Returns:
- The response of the points operation.
-
clearPayload
public Points.PointsOperationResponse clearPayload(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Clears the payload associated with the specified collection, points and ordering. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The points to be cleared.- Returns:
- The response of the clearPayload operation.
-
clearPayloadBlocking
public Points.PointsOperationResponse clearPayloadBlocking(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Clears the payload associated with the specified collection, points and ordering. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The points to be cleared.- Returns:
- The response of the clearPayload operation.
-
getPoints
public Points.GetResponse getPoints(String collectionName, Iterable<? extends Points.PointId> points, Points.WithVectorsSelector withVectors, Points.WithPayloadSelector withPayload, Points.ReadConsistencyType readConsistency) Retrieves points from a collection.- Parameters:
collectionName
- The name of the collection.points
- The IDs of the points to retrieve.withVectors
- The selector for including vectors in the response.withPayload
- The selector for including payload in the response.readConsistency
- The read consistency level for the operation.- Returns:
- The response containing the retrieved points.
-
searchPoints
Performs a search operation on the points.- Parameters:
request
- The search request containing the query parameters.- Returns:
- The response containing the search results.
-
searchBatchPoints
Performs a batch search for points.- Parameters:
request
- The search request containing the batch points to search for.- Returns:
- The response containing the search results.
-
searchGroups
Searches for point groups based on the given request.- Parameters:
request
- The search request containing the criteria for searching point groups.- Returns:
- The response containing the search results for point groups.
-
deletePoints
public Points.PointsOperationResponse deletePoints(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Deletes points from a collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection from which points will be deleted.points
- The selector for the points to be deleted.ordering
- The ordering of the write operation.- Returns:
- The response of the points deletion operation.
-
deletePointsBlocking
public Points.PointsOperationResponse deletePointsBlocking(String collectionName, Points.PointsSelector points, Points.WriteOrderingType ordering) Deletes points from a collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection from which points will be deleted.points
- The selector for the points to be deleted.ordering
- The ordering of the write operation.- Returns:
- The response of the points deletion operation.
-
deleteVectors
public Points.PointsOperationResponse deleteVectors(String collectionName, Points.PointsSelector points, Points.VectorsSelector vectors, Points.WriteOrderingType ordering) Deletes vectors from a collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The selector for points to delete.vectors
- The selector for vectors to delete.ordering
- The write ordering for the operation.- Returns:
- The response of the delete operation.
-
deleteVectorsBlocking
public Points.PointsOperationResponse deleteVectorsBlocking(String collectionName, Points.PointsSelector points, Points.VectorsSelector vectors, Points.WriteOrderingType ordering) Deletes vectors from a collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- The selector for points to delete.vectors
- The selector for vectors to delete.ordering
- The write ordering for the operation.- Returns:
- The response of the delete operation.
-
updateVectors
public Points.PointsOperationResponse updateVectors(String collectionName, Iterable<? extends Points.PointVectors> points, Points.WriteOrderingType ordering) Updates the vectors of points in a collection. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- An iterable of point vectors to update.ordering
- The write ordering for the update operation.- Returns:
- The response of the points operation.
-
updateVectorsBlocking
public Points.PointsOperationResponse updateVectorsBlocking(String collectionName, Iterable<? extends Points.PointVectors> points, Points.WriteOrderingType ordering) Updates the vectors of points in a collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.points
- An iterable of point vectors to update.ordering
- The write ordering for the update operation.- Returns:
- The response of the points operation.
-
scroll
Retrieve points from a collection based on filters.- Parameters:
request
- The search request containing the query parameters.- Returns:
- The response containing the scroll results.
-
recommend
Recommends points based on the given positive/negative points recommendation request.- Parameters:
request
- The points recommendation request.- Returns:
- The recommendation response.
-
recommendBatch
Recommends points batch based on the given positive/negative points recommendation request.- Parameters:
request
- The batch recommendation points request.- Returns:
- The response containing the recommended points.
-
recommendGroups
Recommends groups based on the given positive/negative points recommendation request.- Parameters:
request
- The request containing the point groups to recommend.- Returns:
- The response containing the recommended groups.
-
count
Counts the number of points in a collection based on the given filters.- Parameters:
collectionName
- The name of the collection.filter
- The filter to be applied.- Returns:
- The response containing the points count result.
-
count
Counts the number of points in a collection based on the given filters.- Parameters:
request
- The request containing the filters and options.- Returns:
- The response containing the points count result.
-
updateBatchPoints
public Points.UpdateBatchResponse updateBatchPoints(String collecionName, Iterable<? extends Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Updates a batch of points in a collection. Does not wait for the operation to complete before returning.- Parameters:
collecionName
- The name of the collection.operations
- The operations to be performed on the points.ordering
- The ordering of the write operations.- Returns:
- The response of the batch points update operation.
-
updateBatchPointsBlocking
public Points.UpdateBatchResponse updateBatchPointsBlocking(String collectionName, Iterable<? extends Points.PointsUpdateOperation> operations, Points.WriteOrderingType ordering) Updates a batch of points in a collection. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.operations
- The operations to be performed on the points.ordering
- The ordering of the write operations.- Returns:
- The response of the batch points update operation.
-
createFieldIndex
public Points.PointsOperationResponse createFieldIndex(String collectionName, String fieldName, Points.FieldType fieldType, Collections.PayloadIndexParams fieldIndexParams, Points.WriteOrderingType ordering) Creates a field index in the specified collection with the given parameters. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.fieldName
- The name of the field.fieldType
- The type of the field.fieldIndexParams
- The index parameters for the field.ordering
- The write ordering for the field.- Returns:
- The response of the field index creation operation.
-
createFieldIndexBlocking
public Points.PointsOperationResponse createFieldIndexBlocking(String collectionName, String fieldName, Points.FieldType fieldType, Collections.PayloadIndexParams fieldIndexParams, Points.WriteOrderingType ordering) Creates a field index in the specified collection with the given parameters. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.fieldName
- The name of the field.fieldType
- The type of the field.fieldIndexParams
- The index parameters for the field.ordering
- The write ordering for the field.- Returns:
- The response of the field index creation operation.
-
deleteFieldIndex
public Points.PointsOperationResponse deleteFieldIndex(String collectionName, String fieldName, Points.WriteOrderingType ordering) Deletes the field index for a given collection and field name. Does not wait for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.fieldName
- The name of the field.ordering
- The write ordering for the operation.- Returns:
- The response of the delete operation.
-
deleteFieldIndexBlocking
public Points.PointsOperationResponse deleteFieldIndexBlocking(String collectionName, String fieldName, Points.WriteOrderingType ordering) Deletes the field index for a given collection and field name. Waits for the operation to complete before returning.- Parameters:
collectionName
- The name of the collection.fieldName
- The name of the field.ordering
- The write ordering for the operation.- Returns:
- The response of the delete operation.
-
createSnapshot
Creates a snapshot of a collection.- Parameters:
collectionName
- the name of the collection- Returns:
- The response containing information about the created snapshot
-
listSnapshots
Retrieves a list of snapshots for a given collection.- Parameters:
collectionName
- the name of the collection- Returns:
- The response containing the list of snapshots
-
deleteSnapshot
public SnapshotsService.DeleteSnapshotResponse deleteSnapshot(String collectionName, String snapshotName) Deletes a snapshot with the specified name from the given collection.- Parameters:
collectionName
- The name of the collection.snapshotName
- The name of the snapshot to be deleted.- Returns:
- The response indicating the success or failure of the snapshot deletion.
-
createFullSnapshot
Creates a full snapshot of the Qdrant database.- Returns:
- The response indicating the status of the snapshot creation.
-
listFullSnapshots
Retrieves a list of full snapshots for a given collection.- Parameters:
collectionName
- The name of the collection.- Returns:
- The response containing the list of full snapshots.
-
deleteFullSnapshot
Deletes a full snapshot.- Parameters:
snapshotName
- the name of the snapshot to delete.- Returns:
- The response indicating the status of the snapshot deletion.
-