result = search.get_indexes(namespace='', offset=0, limit=999, start_index_name='f35cef2dfb9a8f34e381386ec5a1f7ee', include_start_index=True, fetch_schema=False)
但是,这里没有id / index
如何在Search API中仅获取记录的id / index? 帮助!!
答案 0 :(得分:1)
你可以使用get_range函数作为
response = index.get_range(start_id =“0”,ids_only = true)
https://developers.google.com/appengine/docs/python/search/indexclass#Index_get_range
答案 1 :(得分:1)
以上代码只会为您提供第一批doc_ids,我不得不花费数小时才能找到它。使用以下代码获取所有doc_ids ...
from google.appengine.api import search
index = search.Index('YOUR_INDEX_NAME')
document_ids = [document.doc_id for document in index.get_range(start_id="0", ids_only=True)]
while len(document_ids)>1:
for doc_id in document_ids:
print doc_id# Do whatever you want with these ID's
document_ids = [document.doc_id for document in index.get_range(start_id=doc_id, ids_only=True)]