Filtering records

    You can supply different parameters to the filter argument to filter the query response accordingly. The available options depend on the fields defined on the model in question.

    If you supply exactly one parameter to the filter argument, the query response will only contain records that fulfill this constraint:

    query {
    allArtists(
    filter: {
    published: { eq: false }
    }
    ) {
    id
    name
    published
    }
    }

    Depending on the type of the field you want to filter by, you have access to different advanced criteria you can use to filter your query response:

    query {
    allArtists(
    filter: {
    name: { in: [ "Blank Banshee", "Gazelle Twin" ] }
    }
    ) {
    id
    name
    genre
    }
    }

    If you specify multiple conditions, they will be combined as if it was a logical AND expression:

    query {
    allAlbums(
    filter: {
    { artist: { eq: "212" } },
    { releaseDate: { gt: "2016-01-01" } }
    }
    ) {
    id
    slug
    artist { name }
    coverImage { url }
    }
    }

    You can also combine AND-like and OR logical expressions. For example, the following query will return all the point of interest located in New York that either have a rating greater than 4 or are a restaurant:

    query {
    allPois(
    filter: {
    address: { matches: { pattern: "new york" } },
    OR: [
    { rating: { gt: 4 } },
    { name: { matches: { pattern: "restaurant" } } },
    ]
    }
    ) {
    name
    address
    rating
    }
    }

    Filters available for field types

    Boolean fields

    Search for records with an exact match
    query {
    allProducts(filter: { booleanField: { eq: true } }) {
    title
    }
    }

    Color fields

    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { colorField: { exists: true } }) {
    title
    }
    }

    Date fields

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(filter: { dateField: { gt: "2018-02-13" } }) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(filter: { dateField: { lt: "2018-02-13" } }) {
    title
    }
    }
    Filter records with a value that's greater than or equal to the one specified
    query {
    allProducts(filter: { dateField: { gte: "2018-02-13" } }) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(filter: { dateField: { lte: "2018-02-13" } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { dateField: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match
    query {
    allProducts(filter: { dateField: { eq: "2018-02-13" } }) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(filter: { dateField: { neq: "2018-02-13" } }) {
    title
    }
    }

    DateTime fields

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(
    filter: {
    dateTimeField: {
    gt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(
    filter: {
    dateTimeField: {
    lt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's greater than or equal to than the one specified
    query {
    allProducts(
    filter: {
    dateTimeField: {
    gte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(
    filter: {
    dateTimeField: {
    lte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { dateTimeField: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match (seconds are truncated)
    query {
    allProducts(
    filter: {
    dateTimeField: {
    eq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(
    filter: {
    dateTimeField: {
    neq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }

    Single file fields

    Search for records with an exact match. The specified value must be an Upload ID
    query {
    allProducts(filter: { fileField: { eq: "123" } }) {
    title
    }
    }
    Exclude records with an exact match. The specified value must be an Upload ID
    query {
    allProducts(filter: { fileField: { neq: "123" } }) {
    title
    }
    }
    Filter records that have one of the specified uploads
    query {
    allProducts(filter: { fileField: { in: ["123"] } }) {
    title
    }
    }
    Filter records that do not have one of the specified uploads
    query {
    allProducts(filter: { fileField: { notIn: ["123"] } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { fileField: { exists: true } }) {
    title
    }
    }

    Floating-point number fields

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(filter: { floatField: { gt: 19.99 } }) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(filter: { floatField: { lt: 19.99 } }) {
    title
    }
    }
    Filter records with a value that's greater than or equal to the one specified
    query {
    allProducts(filter: { floatField: { gte: 19.99 } }) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(filter: { floatField: { lte: 19.99 } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { floatField: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match
    query {
    allProducts(filter: { floatField: { eq: 19.99 } }) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(filter: { floatField: { neq: 19.99 } }) {
    title
    }
    }

    Multiple files fields

    Search for records with an exact match. The specified values must be Upload IDs
    query {
    allProducts(filter: { galleryField: { eq: ["123"] } }) {
    title
    }
    }
    Filter records that have all of the specified uploads. The specified values must be Upload IDs
    query {
    allProducts(filter: { galleryField: { allIn: ["123"] } }) {
    title
    }
    }
    Filter records that have one of the specified uploads. The specified values must be Upload IDs
    query {
    allProducts(filter: { galleryField: { anyIn: ["123"] } }) {
    title
    }
    }
    Filter records that do not have any of the specified uploads. The specified values must be Upload IDs
    query {
    allProducts(filter: { galleryField: { notIn: ["123"] } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { galleryField: { exists: true } }) {
    title
    }
    }

    Integer number fields

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(filter: { integerField: { gt: 3 } }) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(filter: { integerField: { lt: 3 } }) {
    title
    }
    }
    Filter records with a value that's greater than or equal to the one specified
    query {
    allProducts(filter: { integerField: { gte: 3 } }) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(filter: { integerField: { lte: 3 } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { integerField: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match
    query {
    allProducts(filter: { integerField: { eq: 3 } }) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(filter: { integerField: { neq: 3 } }) {
    title
    }
    }

    JSON fields

    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { jsonField: { exists: true } }) {
    title
    }
    }

    Geolocation fields

    Filter records within the specified radius
    query {
    allProducts(
    filter: {
    latLonField: {
    near: { latitude: 40.73, longitude: -73.93, radius: 10 }
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { latLonField: { exists: true } }) {
    title
    }
    }

    Single link fields

    Search for records with an exact match. The specified value must be a Record ID
    query {
    allProducts(filter: { linkField: { eq: "123" } }) {
    title
    }
    }
    Exclude records with an exact match. The specified value must be a Record ID
    query {
    allProducts(filter: { linkField: { neq: "123" } }) {
    title
    }
    }
    Filter records linked to one of the specified records
    query {
    allProducts(filter: { linkField: { in: ["123"] } }) {
    title
    }
    }
    Filter records not linked to one of the specified records
    query {
    allProducts(filter: { linkField: { notIn: ["123"] } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { linkField: { exists: true } }) {
    title
    }
    }

    Multiple links fields

    Search for records with an exact match. The specified values must be Record IDs
    query {
    allProducts(filter: { linksField: { eq: ["123"] } }) {
    title
    }
    }
    Filter records linked to all of the specified records. The specified values must be Record IDs
    query {
    allProducts(filter: { linksField: { allIn: ["123"] } }) {
    title
    }
    }
    Filter records linked to at least one of the specified records. The specified values must be Record IDs
    query {
    allProducts(filter: { linksField: { anyIn: ["123"] } }) {
    title
    }
    }
    Filter records not linked to any of the specified records. The specified values must be Record IDs
    query {
    allProducts(filter: { linksField: { notIn: ["123"] } }) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { linksField: { exists: true } }) {
    title
    }
    }

    SEO meta tags fields

    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { seoField: { exists: true } }) {
    title
    }
    }

    Slug fields

    Search for records with an exact match
    query {
    allProducts(filter: { slugField: { eq: "bike" } }) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(filter: { slugField: { neq: "bike" } }) {
    title
    }
    }
    Filter records that have one of the specified slugs
    query {
    allProducts(filter: { slugField: { in: ["bike"] } }) {
    title
    }
    }
    Filter records that do have one of the specified slugs
    query {
    allProducts(filter: { slugField: { notIn: ["bike"] } }) {
    title
    }
    }

    Single-line string fields

    Filter records based on a regular expression
    query {
    allProducts(
    filter: {
    stringField: {
    matches: { pattern: "bi(cycl|k)e", caseSensitive: false }
    }
    }
    ) {
    title
    }
    }
    Exclude records based on a regular expression
    query {
    allProducts(
    filter: {
    stringField: {
    notMatches: { pattern: "bi(cycl|k)e", caseSensitive: false }
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { stringField: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match
    query {
    allProducts(filter: { stringField: { eq: "bike" } }) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(filter: { stringField: { neq: "bike" } }) {
    title
    }
    }
    Filter records that equal one of the specified values
    query {
    allProducts(filter: { stringField: { in: ["bike"] } }) {
    title
    }
    }
    Filter records that do not equal one of the specified values
    query {
    allProducts(filter: { stringField: { notIn: ["bike"] } }) {
    title
    }
    }

    Multiple-paragraph text fields

    Filter records based on a regular expression
    query {
    allProducts(
    filter: {
    textField: {
    matches: { pattern: "bi(cycl|k)e", caseSensitive: false }
    }
    }
    ) {
    title
    }
    }
    Exclude records based on a regular expression
    query {
    allProducts(
    filter: {
    textField: {
    notMatches: { pattern: "bi(cycl|k)e", caseSensitive: false }
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { textField: { exists: true } }) {
    title
    }
    }

    Video fields

    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { videoField: { exists: true } }) {
    title
    }
    }

    Filters available for meta fields

    Filter by _createdAt meta field

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(
    filter: {
    _createdAt: {
    gt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(
    filter: {
    _createdAt: {
    lt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's greater than or equal to than the one specified
    query {
    allProducts(
    filter: {
    _createdAt: {
    gte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(
    filter: {
    _createdAt: {
    lte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { _createdAt: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match (seconds are truncated)
    query {
    allProducts(
    filter: {
    _createdAt: {
    eq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(
    filter: {
    _createdAt: {
    neq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }

    Filter by id meta field

    Search the record with the specified ID
    query {
    allProducts(filter: { id: { eq: "123" } }) {
    title
    }
    }
    Exclude the record with the specified ID
    query {
    allProducts(filter: { id: { neq: "123" } }) {
    title
    }
    }
    Search records with the specified IDs
    query {
    allProducts(filter: { id: { in: ["123"] } }) {
    title
    }
    }
    Search records that do not have the specified IDs
    query {
    allProducts(filter: { id: { notIn: ["123"] } }) {
    title
    }
    }

    Filter by _firstPublishedAt meta field

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(
    filter: {
    _firstPublishedAt: {
    gt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(
    filter: {
    _firstPublishedAt: {
    lt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's greater than or equal to than the one specified
    query {
    allProducts(
    filter: {
    _firstPublishedAt: {
    gte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(
    filter: {
    _firstPublishedAt: {
    lte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { _firstPublishedAt: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match (seconds are truncated)
    query {
    allProducts(
    filter: {
    _firstPublishedAt: {
    eq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(
    filter: {
    _firstPublishedAt: {
    neq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }

    Filter by parent meta field

    Filter records children of the specified record. Value must be a Record ID
    query {
    allProducts(filter: { parent: { eq: "123" } }) {
    title
    }
    }
    Filter records with a parent record or not
    query {
    allProducts(filter: { parent: { exists: true } }) {
    title
    }
    }

    Filter by position meta field

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(filter: { position: { gt: 3 } }) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(filter: { position: { lt: 3 } }) {
    title
    }
    }
    Filter records with a value that's greater than or equal to the one specified
    query {
    allProducts(filter: { position: { gte: 3 } }) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(filter: { position: { lte: 3 } }) {
    title
    }
    }
    Search for records with an exact match
    query {
    allProducts(filter: { position: { eq: 3 } }) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(filter: { position: { neq: 3 } }) {
    title
    }
    }

    Filter by _publicationScheduledAt meta field

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(
    filter: {
    _publicationScheduledAt: {
    gt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(
    filter: {
    _publicationScheduledAt: {
    lt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's greater than or equal to than the one specified
    query {
    allProducts(
    filter: {
    _publicationScheduledAt: {
    gte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(
    filter: {
    _publicationScheduledAt: {
    lte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { _publicationScheduledAt: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match (seconds are truncated)
    query {
    allProducts(
    filter: {
    _publicationScheduledAt: {
    eq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(
    filter: {
    _publicationScheduledAt: {
    neq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }

    Filter by _publishedAt meta field

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(
    filter: {
    _publishedAt: {
    gt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(
    filter: {
    _publishedAt: {
    lt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's greater than or equal to than the one specified
    query {
    allProducts(
    filter: {
    _publishedAt: {
    gte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(
    filter: {
    _publishedAt: {
    lte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { _publishedAt: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match (seconds are truncated)
    query {
    allProducts(
    filter: {
    _publishedAt: {
    eq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(
    filter: {
    _publishedAt: {
    neq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }

    Filter by _status meta field

    Search the record with the specified status
    query {
    allProducts(filter: { _status: { eq: draft } }) {
    title
    }
    }
    Exclude the record with the specified status
    query {
    allProducts(filter: { _status: { neq: draft } }) {
    title
    }
    }
    Search records with the specified statuses
    query {
    allProducts(filter: { _status: { in: [draft] } }) {
    title
    }
    }
    Search records without the specified statuses
    query {
    allProducts(filter: { _status: { notIn: [draft] } }) {
    title
    }
    }

    Filter by _updatedAt meta field

    Filter records with a value that's strictly greater than the one specified
    query {
    allProducts(
    filter: {
    _updatedAt: {
    gt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less than the one specified
    query {
    allProducts(
    filter: {
    _updatedAt: {
    lt: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's greater than or equal to than the one specified
    query {
    allProducts(
    filter: {
    _updatedAt: {
    gte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with a value that's less or equal than the one specified
    query {
    allProducts(
    filter: {
    _updatedAt: {
    lte: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Filter records with the specified field defined (i.e. with any value) or not
    query {
    allProducts(filter: { _updatedAt: { exists: true } }) {
    title
    }
    }
    Search for records with an exact match (seconds are truncated)
    query {
    allProducts(
    filter: {
    _updatedAt: {
    eq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }
    Exclude records with an exact match
    query {
    allProducts(
    filter: {
    _updatedAt: {
    neq: "2018-02-13T14:30:00+00:00"
    }
    }
    ) {
    title
    }
    }

    Filter by _isValid meta field

    Search for records with an exact match
    query {
    allProducts(filter: { _isValid: { eq: true } }) {
    title
    }
    }