Skip to content

滚动与分页

Scroll 是什么

Search 是按向量找最近邻;Scroll 是按条件遍历点(可带 filter),用于:

  • 全量导出、对账
  • 批量修复 payload
  • 备份前枚举 id

Python Scroll

python
offset = None
while True:
    records, next_offset = client.scroll(
        collection_name="demo_text",
        limit=100,
        offset=offset,
        with_payload=True,
        with_vectors=False,
    )
    if not records:
        break
    for r in records:
        print(r.id, r.payload)
    offset = next_offset
    if next_offset is None:
        break

Java

使用客户端提供的 scrollAsync,传入 collectionlimitoffset(游标),循环直到无下一页。具体类名以当前 java-client 为准。

与 Search 的区别

操作目的
Search给定向量,找最相似 top_k
Scroll分页列出点,按向量排序

注意

超大集合 scroll 会持续占用资源,建议在业务低峰执行并限制并发。

下一节:混合检索与 RRF(向量 + 关键词等)。