ElasticGraph Query API: Equality Filtering

The most commonly used predicate supports equality filtering:

equalToAnyOf
Matches records where the field value is equal to any of the provided values. This works just like an IN operator in SQL.

When null is passed, matches all documents. When an empty list is passed, this part of the filter matches no documents. When null is passed in the list, this part of the filter matches records where the field value is null.

Here’s a basic example:

query EqualityFilter {
  artists(filter: {
    name: {equalToAnyOf: ["U2", "Radiohead"]}
  }) {
    nodes {
      name
      bio {
        yearFormed
      }
    }
  }
}

Unlike the SQL IN operator, you can find records with null values if you put null in the list:

query EqualityFilterNull {
  artists(filter: {
    name: {equalToAnyOf: [null]}
  }) {
    nodes {
      name
      bio {
        yearFormed
      }
    }
  }
}