Google app engine 如何获取所有记录';使用GAE的搜索API中的s id

Google app engine 如何获取所有记录';使用GAE的搜索API中的s id,google-app-engine,python-2.7,gae-search,Google App Engine,Python 2.7,Gae Search,但是,这里没有id/索引 如何在搜索API中仅获取记录的id/索引? 救命 您可以使用get_range函数作为 response=index.get\u range(start\u id=“0”,ids\u only=True) 以上代码只能为您提供我花了数小时才找到的第一批文档ID。使用以下代码获取所有文档ID result = search.get_indexes(namespace='', offset=0, limit=999, start_index_name='f35cef2dfb

但是,这里没有id/索引

如何在搜索API中仅获取记录的id/索引?
救命

您可以使用get_range函数作为

response=index.get\u range(start\u id=“0”,ids\u only=True)


以上代码只能为您提供我花了数小时才找到的第一批文档ID。使用以下代码获取所有文档ID

result = search.get_indexes(namespace='', offset=0, limit=999, start_index_name='f35cef2dfb9a8f34e381386ec5a1f7ee', include_start_index=True, fetch_schema=False)
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)]