GraphQL query language specifications
Data querying specifications
You can query the template instances with GraphQL. A query has these key sections:
A query intent (
query MyQueryName {
, or just{
as a shorthand.The query to run. For templates, this is one of 3 types of query (with an optional alias, for example
myAlias: listActor
):list<type>
, for examplelistActor
lists based on filter parameters.search<type>
, for examplesearchActor
searches based on a query parameter.aggregate<type>
, for exampleaggregateActor
aggregates (count, average etc.) based on a field.See below for more details.
The query parameters. For example
filter: {...}
orlimit: 1000
.The properties to return at a specified depth.
GraphQL example
query myQuery {
countryQuery {
items {
name
demographics {
populationSize
growthRate
}
deaths {
datapoints(limit: 100) {
timestamp
value
}
}
}
nextCursor
}
demographicsQuery(
filter: {
_and: [{ populationSize: { gte: 2 } }, { populationSize: { lte: 10 } }]
}
) {
items {
populationSize
growthRate
metadata {
key
value
}
}
}
}
Where:
myQuery
- declares the query intent.countryQuery
anddemographicsQuery
- are the queries to run.- The parameters are
Country
:100
for thedeath
time series data points, and theDemographics
: filter ofpopulationSize
between 2 and 10. - The properties to return, for
Country
:items
->name
,demographic
->populationSize
,growthRate
, etc.
For more information, see the GraphQL documentation.
Query types
list
queries
list<type>
enables you to filter and sort data quickly. For list<type>
you can use these properties and parameters:
Properties
items
- Specify which properties to be returned.pageInfo
- Details about the current set of items that is returned, such ashasPreviousPage
andhasNextPage
if there is astartCursor
orendCursor
,.
Parameters
filter
- The filter you want to provide. This is based on theproperties
in your data model and you can do array ofand
,or
andnot
to make more complex queries.sort
- The sorting you want to provide. To specify an array ofproperties
and if they are sorted inASC
orDESC
order.after
- ThenextCursor
from the previous query.first
- The maximum number of items to return. To fetch more items, use a anew query using theendCursor
parameter (Default: 1000).
search
queries
search<type>
enables you to search and query data quickly. For search<type>
you can use these properties and parameters:
Properties - The same as for the
list
queries.Parameters
filter
- The filter you want to provide. This is based on theproperties
in your data model and you can do array ofand
,or
, andnot
to make more complex queries.properties
- The properties you want to search on. This can be an array ofproperties
.query
- The actual search queries. Wildcards are supported.first
- The maximum number of items to return. To fetch more items, use a anew query using theendCursor
parameter (Default: 1000)
aggregate
queries
aggregate<type>
enables you to aggregate data quickly. For aggregate<type>
you can use these properties and parameters:
Properties
group
- Depending on thegroupBy
parameter, this indicates the group.avg
- For number properties, you can ask for the average.count
- For any type of properties, you can ask for the total count.histogram(interval: <number>)
- For number properties, you can ask for the histogram at the given interval.max
- For number properties, you can ask for the maximum value.min
- For number properties, you can ask for the minimum value.sum
- For number properties, you can ask for the total sum.pageInfo
- The details about the current set of items that is returned, such ashasPreviousPage
andhasNextPage
to allong if there is astartCursor
orendCursor
.
Parameters
filter
- The filter you want to provide. This is based on theproperties
in your data model and you can do array ofand
,or
, andnot
to make more complex queries.properties
- The properties you want to search. This can be an array ofproperties
.query
- The actual search queries. Wildcards are supported.groupBy
- The field to group by (no relationship allowed),after
- ThenextCursor
from the previous query.
Filter specifications
Field | Filter | How to use | |
---|---|---|---|
Top level filters | Any | and | {and: [{...},{...}]} = if everything is true. |
or | {or: [{...},{...}]} = if at least one is true. | ||
not | {not: {...}} = if false. | ||
Primitives | Any | eq | {eq: ...} |
in | {in: ["..."]} = if any of term. | ||
Nullable | isNull | {isNull: True} = if the field is empty. | |
String | prefix | {prefix: "..."} = starts with. | |
Int/Int64/Float/Timestamp | lt | {lt: ...} = less than. | |
gt | {gt: ...} = greater than. | ||
lte | {lte: ...} = less than or equals. | ||
gte | {gte: ...} = greater than or equals. | ||
TimeSeries | ❌ | None supported. | |
User Defined Type | ❌ | None supported. | |
Lists([XXX]) | ❌ | None supported. |