Your index contains valuable information that may be useful to retrieve for various purposes.

Our SDK provides the capability to fetch detailed information about your index, including metadata, ready and pending vectors, similarity function, and associated namespaces.

Index Info

To fetch the information about your index you can use the getInfo() method as shown below.

use Upstash\Vector\Index;

$index = new Index(
  url: "<UPSTASH_VECTOR_REST_URL>",
  token: "<UPSTASH_VECTOR_REST_TOKEN>",
);

$info = $index->getInfo();

That call will return an instance of Upstash\Vector\IndexInfo.

We can use index info as follows:

// To know the number of vectors ready to query.
$info->vectorCount;

// To know the number of vectors that are getting indexed.
$info->pendingVectorCount;

// To know the size of the index in bytes.
$info->indexSize;

// To know the dimensions of your vector index.
$info->dimension;

// To know which similarity function is being used.
$info->similarityFunction;

// List of namespaces.
$namespaces = $info->namespaces;

// To get information about a specific index you can (More on next section):
$namespaceInfo = $info->namespace('my-namespace');

You can read more about Namespaces and Similarity Functions on our docs.

Namespace Info

Namespaces also contain vectors, which may be pending indexing.

As shown above, you can fetch information about the namespaces when making a getInfo() call on the index.

Additionally, you can use the getNamespaceInfo() method:

use Upstash\Vector\Index;

$index = new Index(
  url: "<UPSTASH_VECTOR_REST_URL>",
  token: "<UPSTASH_VECTOR_REST_TOKEN>",
);

// Fetch the information of the default namespace.
$defaultNamespaceInfo = $index->getNamespaceInfo();

// Fetch the information on a specific namespace.
$myNamespaceInfo = $index->namespace('my-namespace')->getNamespaceInfo();

The getNamespaceInfo() call will return an instance of Upstash\Vector\NamespaceInfo.

We can use namespace info as follows:

// To know the number of vectors ready to query.
$myNamespaceInfo->vectorCount;

// To know the number of vectors that are getting indexed.
$myNamespaceInfo->pendingVectorCount;