Kibana Vega-lite xOffset is not a valid encoding channel

Hello, i've been trying to create a grouped bar chart in kibana with vega lite, as shown in this example, but i always get a warning "xOffset-encoding is dropped as xOffset is not a valid encoding channel". As a result, i don't get to group the bars.

The exemple works fine in the vega editor so i'm wondering if this could be a Kibana issue or if there's there's something i am missing. I share my spec.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Test",
  "data": {
    "format": {
      "property": "aggregations.users_per_day.buckets"
    },
    "url": {
      "index": "test-*",
      "body": {
        "size": 0,
        "aggs": {
          "users_per_day": {
            "date_histogram": {
              "field": "@timestamp",
              "calendar_interval": "day",
              "extended_bounds": {
                "min": 1637539200000,
                "max": 1638144000000
              },
              "min_doc_count": 0
            },
            "aggs": {
              "distinct_users": {
                "cardinality": {
                  "field": "identifier"
                }
              },
              "total_new_users": {
                "cumulative_cardinality": {
                  "buckets_path": "distinct_users"
                }
              },
              "incremental_new_users": {
                "derivative": {
                  "buckets_path": "total_new_users"
                }
              }
            }
          }
        },
        "query": {
          "bool": {
            "must": [
              {
                "range": {
                  "@timestamp": {
                    "gte": "2021-11-22T00:00:00.000Z",
                    "lte": "2021-11-29T00:00:00.000Z",
                    "format": "strict_date_optional_time"
                  }
                }
              }
            ],
            "filter": [],
            "should": [],
            "must_not": []
          }
        }
      }
    },
    "values": {
      "took": 5,
      "timed_out": false,
      "_shards": {
        "total": 56,
        "successful": 56,
        "skipped": 49,
        "failed": 0
      },
      "hits": {
        "total": 170,
        "max_score": null,
        "hits": []
      },
      "aggregations": {
        "users_per_day": {
          "buckets": [
            {
              "key_as_string": "2021-11-22T00:00:00.000Z",
              "key": 1637539200000,
              "doc_count": 5,
              "distinct_users": {
                "value": 3
              },
              "total_new_users": {
                "value": 3
              }
            },
            {
              "key_as_string": "2021-11-23T00:00:00.000Z",
              "key": 1637625600000,
              "doc_count": 17,
              "distinct_users": {
                "value": 1
              },
              "total_new_users": {
                "value": 3
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-24T00:00:00.000Z",
              "key": 1637712000000,
              "doc_count": 32,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 3
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-25T00:00:00.000Z",
              "key": 1637798400000,
              "doc_count": 31,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 3
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-26T00:00:00.000Z",
              "key": 1637884800000,
              "doc_count": 40,
              "distinct_users": {
                "value": 5
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": 3
              }
            },
            {
              "key_as_string": "2021-11-27T00:00:00.000Z",
              "key": 1637971200000,
              "doc_count": 30,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-28T00:00:00.000Z",
              "key": 1638057600000,
              "doc_count": 15,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-29T00:00:00.000Z",
              "key": 1638144000000,
              "doc_count": 0,
              "distinct_users": {
                "value": 0
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": null
              }
            }
          ]
        }
      }
    }
  },
  "repeat": {
    "layer": [
      "distinct_users.value",
      "total_new_users.value",
      "incremental_new_users.value"
    ]
  },
  "spec": {
    "mark": "bar",
    "encoding": {
      "x": {
        "field": "key",
        "type": "nominal",
        "timeUnit": "monthdate",
        "axis": {
          "title": "Date"
        }
      },
      "y": {
        "field": {
          "repeat": "layer"
        },
        "type": "quantitative",
        "axis": {
          "title": "Number of users"
        }
      },
      "color": {
        "datum": {
          "repeat": "layer"
        },
        "type": "nominal"
      },
      "xOffset": {
        "datum": {
          "repeat": "layer"
        }
      }
    }
  },
  "config": {
    "range": {
      "category": {
        "scheme": "elastic"
      }
    },
    "mark": {
      "color": "#54B399"
    },
    "title": {
      "color": "#343741"
    },
    "style": {
      "guide-label": {
        "fill": "#69707d"
      },
      "guide-title": {
        "fill": "#343741"
      },
      "group-title": {
        "fill": "#343741"
      },
      "group-subtitle": {
        "fill": "#343741"
      }
    },
    "axis": {
      "tickColor": "#eef0f3",
      "domainColor": "#eef0f3",
      "gridColor": "#eef0f3"
    },
    "background": "transparent"
  },
  "width": "container",
  "height": "container",
  "autosize": {
    "type": "fit",
    "contains": "padding"
  }
}

you need vega vesion 5 for this feature and is not available before

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.