Skip to content

v6: Collections API#336

Open
bevzzz wants to merge 25 commits intov6from
v6-collections
Open

v6: Collections API#336
bevzzz wants to merge 25 commits intov6from
v6-collections

Conversation

@bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Feb 16, 2026

ℹ️ Merge #319 and #337 first to reduce diff

This PR adds the lower-level requests and the public API for managing Weaviate collections: create, get, list, exists, delete, and delete all.

We also introduce collections.Handle container for .Data, .Query, and other namespaces, and functional options to configure set tenant / consistency level for the handle.

Key changes:

  • internal/api/collections.go - requests and endpoint implementations
  • collections/client.go - public API, the "collections" namespace
  • internal/api/exists.go - universal dest type for HEAD-like requests (where the body is returned, but we can discard it)
  • internal/transports/rest.go - new Endpoint utilities: StaticEndpoint and IdentityEndpoint
  • internal/api/endpoint_test.go, internal/api/exists_test.go, internal/transports/rest_test.go and collections/client_test.go - supporting unit tests

Miscellaneous:

  • testkit.MockTransport can now handle heterogenous request-response stubs. This gives the developer to test a public API method, which may make several different "transport calls" to execute. See TestClient_DeleteAll for an illustrative example.

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz mentioned this pull request Mar 4, 2026
Name string
Description string
DataType DataType
NestedProperties []Property
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: A NestedProperty is necessarily different to a Property since you can't set inverted indices nor tokenization on a nested property. Perhaps you're aiming defensively here in case that changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't thought about that before to be honest. Planning for future change is a reasonable objective (I can imagine how we might allow building some inverted inverted index on the object property in the future), but my main intention here was simplicity.

you can't set inverted indices nor tokenization on a nested property

I'd argue that a separate NestedProperty type will over-specify the API. Consider: IndexRangeFilters is only applicable to int, number, and date property types, and Tokenization cannot be set for anything other than text and text[] properties. Still, we do not provide distinct ArithmeticProperty, TextProperty and BlobProperty in the spirit of keeping things simple and, as you've suggested, flexible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that a separate NestedProperty type will over-specify the API

We are currently planning filtering+search support for NestedProperty and there is a good chance that some config values will be different than normal Properties. I think for this case it makes sense to have an extra type

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config values will be different than normal Properties

Do you mean like Tokenization field would exist but would accept a different value? E.g. it's string for text/text[] properties but []bool for object/object[]? If that's the case, then I agree that this warrants a separate type.

I don't think it is necessary otherwise. If we take a close look a the current property config options, most of the properties aren't "normal".

// Applicable to all property types without exception
Name              string
Description       string
DataType          DataType

// Exclusive to `object` and `object[]`
NestedProperties  []Property

// Exclusive to `text` and `text[]`
Tokenization      Tokenization
IndexSearchable   bool

// Exclusive to `int`, `number`, and `date`
IndexRangeFilters bool

// Not applicable to `blob`, `object`, `geoCoordinates`, `phoneNumber`
IndexFilterable   bool

Only 4/8 configurations are applicable to "most" property types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also makes the API less consistent. Consider an object property address { street, building_nr }:

NestedProperties: []Property{ 
  {Name: "street", DataType: "text", IndexSearchable; true}, // Invalid -- NestedProperty would fix that
  {Name: "building_nr", DataType: "int"},
}

The issue with using Property directly is I can specify IndexSearchable which is a mistake -- the NestedProperty simply wouldn't expose that config. What if in the future we decide to make nested text searchable but not text[]? We'll extend NestedProperty with a new field and end up where we started, i.e. the user can accidentally send an invalid request.

NestedProperties: []NestedProperty{
   {Name: "one": DataType: "text", IndexSearchable: true}, // OK
   {Name: "many": DataType: "text[]", IndexSearchable: true}, // Invalid
},

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean like Tokenization field would exist but would accept a different value? E.g. it's string for text/text[] properties but []bool for object/object[]? If that's the case, then I agree that this warrants a separate type.

We are still in the planning phase so I cant tell you exactly what we have, but we might end up with different options for IndexRangeable than normal Properties. As we are quite far away from GA I am also ok with leaving it as normal Property for now with the option of changing it in the future (I haven't read the complete thread)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to note as well is that Property and NestedProperty are different types in the OpenAPI schema too so removing that point of difference in the client would be a conscious choice to differ from the server (not necessarily a bad thing, just pointing out)

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

Successfully merging this pull request may close these issues.

3 participants