🧠Using Metadata Filters

Supported metadata types

You can associate a metadata payload with each vector in an index, as key-value pairs in a JSON object where keys are strings and values are one of:

  • String

  • Number (integer or floating point, gets converted to a 64 bit floating point)

  • Booleans (true, false)

  • List of String

The metadata filters can be combined with AND and OR:

  • $eq - Equal to (number, string, boolean)

  • $ne - Not equal to (number, string, boolean)

  • $gt - Greater than (number)

  • $gte - Greater than or equal to (number)

  • $lt - Less than (number)

  • $lte - Less than or equal to (number)

  • $in - In array (string or number)

  • $nin - Not in array (string or number)

Using arrays of strings as metadata values or as metadata filters

A vector with metadata payload...

...means the "genre" takes on both values.

For example, queries with the following filters will match the vector:

Queries with the following filter will not match the vector:

And queries with the following filters will not match the vector because they are invalid. They will result in a query compilation error:

More example filter expressions

A comedy, documentary, or drama:

A drama from 2020:

A drama from 2020 (equivalent to the previous example):

A drama or a movie from 2020:

Last updated