Skip to content

fix: create missing payload indexes on existing collections - #216

Merged
chadha-sridi merged 3 commits into
masterfrom
fix/missing-payload-indexes
Nov 27, 2026
Merged

chadha-sridi merged 3 commits into
masterfrom
fix/missing-payload-indexes

Conversation

@chadha-sridi

Copy link
Copy Markdown
Contributor

Problem

The server creates the payload indexes for FILTERABLE_FIELDS only when it creates the collection. They're never created when:

  • a filterable field is added after the collection was created;
  • the collection was created outside the server, for example to use a collection-scoped API key, which can't create collections.

On collections in strict mode, the default on Qdrant Cloud, every qdrant-find that uses the field then fails:

Bad request: Index required but not found for "metadata.lang" of one of the following types: [keyword]

Elsewhere, filtering on the field works but without an index.

Changes

  • QdrantConnector._create_missing_indexes() compares the configured indexes with the collection's payload_schema and creates the missing ones.
  • _ensure_collection_exists() (store) and search() (find) call it with the collection info they already fetch, so there's no extra request when nothing is missing. search() needs it too: in read-only mode, qdrant-store is disabled and never runs.
  • If the API key isn't allowed to create an index (403, for example a read-only key), the server logs a warning that names the collection and field, and carries on. Other errors are raised.
  • Local mode is skipped: it ignores payload indexes, never reports them, and warns on every create_payload_index call.

Testing

New tests in tests/test_payload_indexes.py: indexes created from store and from search, existing indexes left alone, local mode untouched, a 403 logs a warning without failing the search, and other errors are raised. Five of the six fail without the fix. The full suite and pre-commit pass.

Against Qdrant 1.20.0, with a collection created outside the server, in strict mode, and a metadata.lang keyword field configured:

Key Before After
Full access find fails: "Index required but not found" index created, find works
Read-write, scoped to the collection (same as above) index created, find works
Read-only find fails warning names the missing index; find still fails, as the key can't create it

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chadha-sridi
chadha-sridi merged commit a72a777 into master Nov 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants