Aggregations in guillotine in Apollo Angular

Enonic version: 7.9.2.
OS: Windows 10


I’m having a problem with aggregations in a guillotine query when using Apollo Angular.
Here’s the query method:

public static GetAvailableCategories(): QueryOptions {
    const query = `{
      guillotine {
          query: "type=''",
          aggregations: {
            name: "categories",
            terms: {
              field: "data.category"
              size: 500
        ) {
    return {
      query: gql(query)

In the Enonic XP content studio playground, the query result returns as expected:

  "data": {
    "guillotine": {
      "queryConnection": {
        "aggregationsAsJson": {
          "categories": {
            "buckets": [
                "key": "a6aec745-b66a-4397-b350-6ba7495a59d0",
                "docCount": 1
                "key": "46dc49d5-90d1-4830-bfcf-0867c0ca964a",
                "docCount": 2
                "key": "4ca44465-b3e1-4e4e-925c-16adec7564ed",
                "docCount": 3
                "key": "f0bd3664-b6e2-4537-8702-13508a06ed16",
                "docCount": 4
                "key": "a1f33434-6ab0-4457-8a8b-b290cb1181b1",
                "docCount": 5

However, when I try to fetch the data through Apollo Angular using this method:

public executeQuery(options: QueryOptions): Promise<QueryResponse> {
    let apolloBase: ApolloBase<any>;
    switch (this.language) {
      case 'en':
        apolloBase = this.apollo.use(this.language);
        apolloBase = this.apollo;
    return new Promise((resolve, reject) => {
          ({data}) => {
          err => {

It throws this error:

Error: Uncaught (in promise): Error: GraphQL error: Validation error of type UnknownArgument: Unknown field argument aggregations @ 'guillotine/queryConnection'
GraphQL error: Validation error of type FieldUndefined: Field 'aggregationsAsJson' in type 'ContentConnection' is undefined @ 'guillotine/queryConnection/aggregationsAsJson'
    at new ApolloError (bundle.esm.js:63:1)
    at bundle.esm.js:1247:1
    at bundle.esm.js:1559:1
    at Set.forEach (<anonymous>)
    at bundle.esm.js:1557:1
    at Map.forEach (<anonymous>)
    at push.dMq0.QueryManager.broadcastQueries (bundle.esm.js:1555:1)
    at bundle.esm.js:1646:1
    at (Observable.js:322:1)
    at notifySubscription (Observable.js:135:1)
    at resolvePromise (zone-evergreen.js:798:1)
    at resolvePromise (zone-evergreen.js:750:1)
    at zone-evergreen.js:860:1
    at ZoneDelegate.invokeTask (zone-evergreen.js:399:1)
    at Object.onInvokeTask (core.js:28567:1)
    at ZoneDelegate.invokeTask (zone-evergreen.js:398:1)
    at Zone.runTask (zone-evergreen.js:167:1)
    at drainMicroTaskQueue (zone-evergreen.js:569:1)
    at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:484:1)
    at invokeTask (zone-evergreen.js:1621:1)

It basically doesn’t recognize aggregation and aggregationsAsJson as valid fields, since without them, the query works fine, and having it in a guillotine is necessary. What should I do to make the aggregation fields work?

Hi @pcermak,

Something is wrong here. The queryConnection field returns the QueryContentConnection type. However, in the provided error, I can see the ContentConnection type. The ContentConnection type is used for getChildrenConnection of the HeadlessCms type. This field also does not have the aggregations argument.

Could you please double-check it on your end? Maybe do you have aliases for this field, where you can use getChildrenConntection.

If the problem still appears, please provide the version of Guillotine as well.

Additionally, please note that the query and queryConnection fields are deprecated starting from version 6.1.0 API - Enonic Developer Portal. You should use queryDsl and queryDslConnection instead.

Hi @asi,

I tried looking but unfortunately, I didn’t manage to find any aliases for the field. Additionally, enonic doesn’t seem to register queryDsl and queryDslConnection as valid guillotine fields, though I may be doing something wrong. For reference, the guillotine version is 6.0.6.

Anyways, thanks for your help!

Yes, QueryDSL is supported starting from version 6.1.0. I think it makes sense to update the version of Guillotine.