Upstash Vector allows you to partition a single index into multiple isolated namespaces. Each namespace acts as a self-contained subset of the index, and read and write requests are limited to one namespace.
Each vector index has at least one default namespace and optionally many more.
If no namespace is specified, the operations will use the default namespace, which has the name "" (empty string).
Indexes created before the namespaces feature can still be used as they are, without modification. All operations are assumed to use the default namespace.
Using a Namespace#
Namespaces are created implicitly when an upsert operation is performed, so there is no specific endpoint for creating a namespace.
For example, the code snippet below will create the namespace ns if it does not already exist, upsert and query the vector only on that namespace.
Under the hood, when using a namespace, your requests are sent to <vector-url>/<command>/namespace-name to only be executed only against that namespace.
Namespace Names#
Namespace names may contain characters such as ?, #, :, @ and spaces. Pass the name as it is; the JavaScript SDK encodes it in the request, so ?, # and spaces stay part of the name instead of being read as part of the URL.
In the JavaScript SDK, names that cannot be used as a namespace are not sent, and the request fails with an UpstashError instead: a name cannot be . or .., and it cannot contain /, \, % or a control character such as a tab or a new line. Pass the namespace name as it is, without percent-encoding it.
Deleting a Namespace#
Namespaces can be deleted by using the Delete Namespace API.
Listing Namespaces#
All active namespaces can be listed by using the List Namespaces API.