Skip to content

Vector field with index_missing=True cannot be created #770

Open

Description

@RaphaelFakhri

Description

A vector field declared with index_missing: True makes SearchIndex.create() fail. The same review thread on #742 noted this, and the from_existing parser skips INDEXMISSING on vector fields for this reason.

BaseVectorFieldAttributes.field_data adds "INDEXMISSING": True to the algorithm attribute dict. redis-py's VectorField counts and sends every dict entry inside the attribute block, so:

  1. The client rejects the Python bool before sending: Invalid input of type: 'bool'.
  2. Even as a string, the server rejects the token inside the block: Bad arguments for algorithm HNSW: INDEXMISSING.

FT.CREATE expects INDEXMISSING after the attribute block, which is where redis-py puts it when you pass index_missing=True to the field constructor.

Reproduction

Redis 8.4, redis-py 8.1.0, RedisVL main (e5d7598):

from redisvl.index import SearchIndex

schema = {
    "index": {"name": "im", "prefix": "im", "storage_type": "hash"},
    "fields": [
        {"name": "id", "type": "tag"},
        {"name": "emb", "type": "vector",
         "attrs": {"dims": 3, "algorithm": "hnsw", "index_missing": True}},
    ],
}
SearchIndex.from_dict(schema, redis_url="redis://localhost:6379").create()
redisvl.exceptions.RedisSearchError: Failed to create index 'im' on Redis:
Invalid input of type: 'bool'. Convert to a bytes, string, int or float first.

The same happens with flat and svs-vamana.

Expected behavior

The index is created with INDEXMISSING on the vector field, and ismissing(@emb) matches documents without the field.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions