To check whether the change has been propagated, compare the update index operation finish time and the DeployedIndex.index_sync_time
ref: https://cloud.google.com/vertex-ai/docs/vector-search/update-rebuild-index?hl=en
Index
の更新が DeployedIndex
に伝播されたかを確認するために index_sync_time
を参照せよ、とのことだが具体的な参照方法が記載されておらず困った。
色々試してみた結果以下のようにすればよいことが分かった。
DeployedIndex
を直接参照する方法が見つからなかったため、まず IndexEndpoint
を取得し、IndexEndponit
が持つ deployed_indexes
を参照する形になっている。
from google.cloud import aiplatform
INDEX_ENDPOINT_NAME='projects/xxxxxx/locations/xxxxxx/indexEndpoints/xxxxxx'
index_endpoint = aiplatform.MatchingEngineIndexEndpoint(
index_endpoint_name=INDEX_ENDPOINT_NAME
)
index_sync_time = index_endpoint.deployed_indexes[0].index_sync_time
P.S.
DeployedIndex
を直接参照する方法はないため、まず IndexEndpoint を取得し、IndexEndponit
が持つdeployed_indexes
を参照する
IndexEndponit
が持つ deployed_indexes
の内容は以下のようになっている。
from google.cloud import aiplatform
INDEX_ENDPOINT_NAME='projects/xxxxxx/locations/xxxxxx/indexEndpoints/xxxxxx'
index_endpoint = aiplatform.MatchingEngineIndexEndpoint(
index_endpoint_name=INDEX_ENDPOINT_NAME
)
print(index_endpoint.deployed_indexes[0])
id: "xxxxxx"
index: "projects/xxxxxx/locations/xxxxxx/indexes/xxxxxx"
display_name: "xxxxxx"
create_time {
seconds: 1733286121
nanos: 942464000
}
index_sync_time {
seconds: 1733366784
nanos: 183820000
}
automatic_resources {
min_replica_count: 1
max_replica_count: 1
}
ちなみに IndexEndpoint
ではなく Index
からも deployed_indexes
を参照できるが、ここには index_sync_time
が含まれていなかった。
from google.cloud import aiplatform
INDEX_NAME = "xxxxxx"
index = aiplatform.MatchingEngineIndex(index_name=INDEX_NAME)
print(index.deployed_indexes[0])
index_endpoint: "projects/xxxxxx/locations/xxxxxx/indexEndpoints/xxxxxx"
deployed_index_id: "xxxxxx"
display_name: "xxxxxx"