ElasticGraph Query API: Filter Negation

ElasticGraph supports a negation predicate:

not
Matches records where the provided sub-filter evaluates to false. This works just like a NOT operator in SQL.

Will be ignored when null or an empty object is passed.

One of the more common use cases is to filter to non-null values:

query FindArtistsWithBios {
  artists(filter: {
    bio: {description: {not: {equalToAnyOf: [null]}}}
  }) {
    nodes {
      name
      bio {
        description
      }
    }
  }
}

not is available at any level of a filter. All of these are equivalent:

  • bio: {description: {not: {equalToAnyOf: [null]}}}
  • bio: {not: {description: {equalToAnyOf: [null]}}}
  • not: {bio: {description: {equalToAnyOf: [null]}}}