Skip to main content
Version: V1.4.1

refresh_index - Advance async vector index visibility

Collection.refresh_index() ensures that committed asynchronous writes on the table backing the current Collection become visible in approximate vector search as soon as possible when HNSW vector indexes use asynchronous maintenance. It corresponds to SQL CALL dbms_index_manager.refresh();. For details, see REFRESH (DBMS_INDEX_MANAGER).

info

Call this method only on a Collection instance obtained through a Client connection. For more information about Client, see Client.

Description​

  • In server mode and embedded mode, seekdb uses asynchronous vector indexes by default starting in V1.3.0. To see data in approximate search immediately after a write, call refresh_index() after add, upsert, or similar write operations.

Prerequisites​

  • You have installed pyseekdb. For installation instructions, see Get started.
  • You have connected to the database. See Client.
  • You have obtained the target Collection (for example, through create_collection or get_collection).

Request parameters​

None.

Response parameters​

None (the method returns after the server advances visibility).

Request example​

import pyseekdb
from pyseekdb import HNSWConfiguration, Schema, VectorIndexConfig

client = pyseekdb.Client(
host="127.0.0.1",
port=2881,
database="test",
user="root",
)

name = "t1"
schema = Schema(
vector_index=VectorIndexConfig(
hnsw=HNSWConfiguration(dimension=3, distance="l2")
)
)
collection = client.create_collection(
name=name,
Schema=schema,
embedding_function=None,
)

collection.add(
ids=["16", "17", "18"],
embeddings=[[1.0, 2.0, 3.0], [1.1, 2.1, 3.1], [1.2, 2.2, 3.3]],
documents=["seekdb 1.0", "seekdb 1.1", "seekdb 1.2"],
)

collection.refresh_index()

res = collection.query(
query_embeddings=[[100.0, 100.0, 100.0]],
n_results=5,
include=["documents"],
)
print("result ids:", res["ids"][0])

client.delete_collection(name)

References​