Skip to Page NavigationSkip to Page NavigationSkip to Content
Keystone 6 is in Community Preview! What does that mean? see our Roadmap. For Keystone 5 docs, visit v5.keystonejs.com

Query Filter API

Each field type provides its own set of filters which can be used with queries. This page lists all the filters available for each field type. For more details on how to use filters in queries please consult to the GraphQL Queries - Filters guide.

Keystone filters are typically named after the field they are filtering. For example, a text field called foo would have filters named foo_starts_with, foo_contains, etc. In all the examples below we will use a field named foo as the base of the filter names.

Scalar types

checkbox

Filter nameTypeDescription
fooBooleanEquals
foo_notBooleanDoes not equal

integer

Filter nameTypeDescription
fooIntEquals
foo_notIntDoes not equal
foo_ltIntLess than
foo_lteIntLess than or equal
foo_gtIntGreater than
foo_gteIntGreater than or equal
foo_in[Int]Is in the array
foo_not_in[Int]Is not in the array

json

The json field type does not support filters.

float

Filter nameTypeDescription
fooFloatEquals
foo_notFloatDoes not equal
foo_ltFloatLess than
foo_lteFloatLess than or equal
foo_gtFloatGreater than
foo_gteFloatGreater than or equal
foo_in[Float]Is in the array
foo_not_in[Float]Is not in the array

password

Filter nameTypeDescription
foo_is_setBooleanA value is set

select

Filter nameTypeDescription
fooStringEquals
foo_notStringDoes not equal
foo_in[String]Is in the array
foo_not_in[String]Is not in the array

text

Filter nameTypeDescription** Notes **
fooStringEquals
foo_notStringDoes not equal
foo_containsStringContains
foo_not_containsStringDoes not contain
foo_starts_withStringStarts withpostgresql only
foo_not_starts_withStringDoes not start withpostgresql only
foo_ends_withStringEnds withpostgresql only
foo_not_ends_withStringDoes not end withpostgresql only
foo_iStringEquals (case insensitive)postgresql only
foo_not_iStringDoes not equal (case insensitive)postgresql only
foo_contains_iStringContains (case insensitive)postgresql only
foo_not_contains_iStringDoes not contain (case insensitive)postgresql only
foo_starts_with_iStringStarts with (case insensitive)postgresql only
foo_not_starts_with_iStringDoes not start with (case insensitive)postgresql only
foo_ends_with_iStringEnds with (case insensitive)postgresql only
foo_not_ends_with_iStringDoes not end with (case insensitive)postgresql only
foo_in[String]Is in the array
foo_not_in[String]Is not in the array

timestamp

Filter nameTypeDescription
fooStringEquals
foo_notStringDoes not equal
foo_ltStringLess than
foo_lteStringLess than or equal
foo_gtStringGreater than
foo_gteStringGreater than or equal
foo_in[String]Is in the array
foo_not_in[String]Is not in the array

Relationship type

relationship

many: true

Filter nameTypeDescription
foos_everyFooWhereInputAll related items match the nested filter
foos_someFooWhereInputSome related items match the nested filter
foos_noneFooWhereInputNo related items match the nested filter

many: false

Filter nameTypeDescription
fooFooWhereInputMatches the nested filter
foo_is_nullBooleanIs null

Index types

autoIncrement

Filter nameTypeDescription
idIDEquals
id_notIDDoes not equal
id_ltIDLess than
id_lteIDLess than or equal
id_gtIDGreater than
id_gteIDGreater than or equal
id_in[ID]Is in the array
id_not_in[ID]Is not in the array

Virtual type

virtual

The virtual field type does not support filters.

File types

file

The file field type does not support filters.

image

The image field type does not support filters.