Class QdrantClient

java.lang.Object
io.qdrant.client.QdrantClient

public class QdrantClient extends Object
Client for interfacing with the Qdrant service.
  • Constructor Details

  • Method Details

    • listCollections

      public Collections.ListCollectionsResponse listCollections()
      Retrieves a list of collections.
      Returns:
      The response containing the list of collections.
    • healthCheck

      public QdrantOuterClass.HealthCheckReply healthCheck()
      Performs a health check on the Qdrant service.
      Returns:
      The health check reply from the Qdrant service.
    • hasCollection

      public boolean hasCollection(String collectionName)
      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

      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

      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

      Updates a collection with the specified details.
      Parameters:
      details - The details of the update operation.
      Returns:
      The response containing the operation status.
    • deleteCollection

      public Collections.CollectionOperationResponse deleteCollection(String collectionName)
      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

      public Collections.GetCollectionInfoResponse getCollectionInfo(String collectionName)
      Retrieves information about a collection.
      Parameters:
      collectionName - The name of the collection.
      Returns:
      The response containing the collection information.
    • createAlias

      public Collections.CollectionOperationResponse createAlias(String collectionName, String aliasName)
      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

      public Collections.CollectionOperationResponse deleteAlias(String aliasName)
      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

      public Collections.ListAliasesResponse listCollectionAliases(String collectionName)
      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

      public Collections.ListAliasesResponse listAliases()
      Retrieves a list of aliases.
      Returns:
      The response containing the list of aliases.
    • getCollectionClusterInfo

      public Collections.CollectionClusterInfoResponse getCollectionClusterInfo(String collectionName)
      Retrieves the cluster information for a specific collection.
      Parameters:
      collectionName - The name of the collection.
      Returns:
      The cluster information for the collection.
    • updateCollectionClusterSetup

      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

      public Points.SearchResponse searchPoints(Points.SearchPoints request)
      Performs a search operation on the points.
      Parameters:
      request - The search request containing the query parameters.
      Returns:
      The response containing the search results.
    • searchBatchPoints

      public Points.SearchBatchResponse searchBatchPoints(Points.SearchBatchPoints request)
      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

      public Points.ScrollResponse scroll(Points.ScrollPoints request)
      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

      public Points.CountResponse count(String collectionName, Points.Filter filter)
      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

      public Points.CountResponse count(Points.CountPoints request)
      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

      public SnapshotsService.CreateSnapshotResponse createSnapshot(String collectionName)
      Creates a snapshot of a collection.
      Parameters:
      collectionName - the name of the collection
      Returns:
      The response containing information about the created snapshot
    • listSnapshots

      public SnapshotsService.ListSnapshotsResponse listSnapshots(String collectionName)
      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

      public SnapshotsService.CreateSnapshotResponse createFullSnapshot()
      Creates a full snapshot of the Qdrant database.
      Returns:
      The response indicating the status of the snapshot creation.
    • listFullSnapshots

      public SnapshotsService.ListSnapshotsResponse listFullSnapshots(String collectionName)
      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

      public SnapshotsService.DeleteSnapshotResponse deleteFullSnapshot(String snapshotName)
      Deletes a full snapshot.
      Parameters:
      snapshotName - the name of the snapshot to delete.
      Returns:
      The response indicating the status of the snapshot deletion.