QD
Propertiestocollection
qdrant/qdrant#6600

Add Collection-Level Properties Support

Changes

  • Collection Properties Field

    • Added an optional properties: Option<serde_json::Value> field to CollectionConfigInternal and CollectionInfo.
    • Properties are persisted and included in collection info responses.
  • REST API Endpoints

    • GET /collections/{name}/properties: Retrieve all collection-level properties as a JSON object.
    • PATCH /collections/{name}/properties: Set or update one or more properties by sending a JSON object.
    • DELETE /collections/{name}/properties/{key}: Remove a property by key.
  • Collection Methods

    • Added async methods to the Collection struct for setting, getting, and removing properties, with persistence.
  • Forward-Compatible Pattern Matching

    • Updated all pattern matches and struct initializations for CollectionConfigInternal and CollectionInfo to use .. for forward compatibility.

Working Screenshot -

Screenshot 2025-05-27 at 6 25 03 PM

Testing -

You can verify the feature with the following curl commands:

  1. Create Collection

    curl -X PUT "http://localhost:6333/collections/test_collection" \
      -H "Content-Type: application/json" \
      -d '{"vectors":{"size":4,"distance":"Cosine"}}'
    

    Response:

    {"result":true,"status":"ok","time":...}
    

    Purpose: Creates a new collection named test_collection.

  2. Get Properties (Initially)

    curl "http://localhost:6333/collections/test_collection/properties"
    

    Response:

    {}
    

    Purpose: Confirms no properties are set initially.

  3. Set Multiple Properties

    curl -X PATCH "http://localhost:6333/collections/test_collection/properties" \
      -H "Content-Type: application/json" \
      -d '{"main_column":"column a", "description":"Test collection"}'
    

    Response:

    {"result":"ok"}
    

    Purpose: Sets main_column and description.

  4. Get Properties (After Setting)

    curl "http://localhost:6333/collections/test_collection/properties"
    

    Response:

    {"main_column":"column a","description":"Test collection"}
    
  5. Update a Single Property

    curl -X PATCH "http://localhost:6333/collections/test_collection/properties" \
      -H "Content-Type: application/json" \
      -d '{"description":"Updated description"}'
    

    Response:

    {"result":"ok"}
    
  6. Get Properties (After Update)

    curl "http://localhost:6333/collections/test_collection/properties"
    

    Response:

    {"main_column":"column a","description":"Updated description"}
    
  7. Delete a Property

    curl -X DELETE "http://localhost:6333/collections/test_collection/properties/main_column"
    

    Response:

    {"result":"ok"}
    
  8. Get Properties (After Deletion)

    curl "http://localhost:6333/collections/test_collection/properties"
    

    Response:

    {"description":"Updated description"}
    
  9. Delete Last Property

    curl -X DELETE "http://localhost:6333/collections/test_collection/properties/description"
    

    Response:

    {"result":"ok"}
    
  10. Get Properties (After All Deletions)

    curl "http://localhost:6333/collections/test_collection/properties"
    

    Response:

    {}
    

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren’t other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you’d like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Solves - #3957 /claim #3957

Claim

Total prize pool $100
Total paid $0
Status Pending
Submitted May 27, 2025
Last updated May 27, 2025

Contributors

LU

Luffy

@luffy-orf

100%

Sponsors

QD

Qdrant

@Qdrant

$100