Pinecone Namespaces
A namespace scopes records and queries within an index. It can organize tenants or categories, but is not by itself an authorization system: the backend must derive the allowed namespace from the authenticated principal.
#Scope writes and reads consistently
pythonindex.upsert( vectors=[("sample", [0.1, 0.2, 0.3], {"topic": "example"})], namespace="user-123", ) results = index.query( vector=[0.1, 0.2, 0.3], top_k=5, namespace="user-123" )
These synthetic vectors assume an existing three-dimensional demonstration index. Real embeddings must match the index's model/dimension.
#Namespace lifecycle
The source describes a default namespace and creation through ingestion. It also discusses explicit creation, listing and metadata schema features on supported serverless APIs. Check the API version/index type rather than assuming legacy pods support the same operations.
python# Destructive: clears the selected namespace. # index.delete(delete_all=True, namespace="user-123")
#Namespace versus metadata
Namespaces define a data/query boundary. Metadata provides flexible tags and filters within that boundary. Use both where appropriate; do not rely on a client-supplied tag or namespace to enforce tenant access.
A query targets the supported namespace scope. Searching multiple scopes may require separate authorized queries and merging, or a deliberately designed shared corpus. Do not merge tenant data merely to simplify a search.
Design namespace naming, authorization, deletion and cross-scope behavior at the beginning of a multi-user retrieval application.