ElasticGraph Query API: Filtering
Use filter:
on a root query field to narrow down the returned results:
As shown here, filters have two basic parts:
- A field path: this specifies which field you want to filter on. When dealing with a nested field (e.g.
bio.yearFormed
), you’ll need to provide a nested object matching the field structure. - A filtering predicate: this specifies a filtering operator to apply at the field path.
Ignored Filters
Filters with a value of null
or empty object ({}
) are ignored. The filters in this query are all ignored:
This particularly comes in handy when using query variables. It allows a query to flexibly support a wide array of filters without requiring them to all be used for an individual request.