# Trouble transforming \_source field in VEGA for hits.hits formatted data

**URL:** https://discuss.elastic.co/t/trouble-transforming-source-field-in-vega-for-hits-hits-formatted-data/381377
**Category:** Kibana
**Tags:** vega
**Created:** [August 27, 2025, 2:32pm UTC](https://discuss.elastic.co/t/trouble-transforming-source-field-in-vega-for-hits-hits-formatted-data/381377 "2025-08-27T14:32:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![DOH-moodys](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@DOH-moodys](https://discuss.elastic.co/u/DOH-moodys)
#### Post date: [August 27, 2025, 2:32pm UTC](https://discuss.elastic.co/t/trouble-transforming-source-field-in-vega-for-hits-hits-formatted-data/381377/1 "2025-08-27T14:32:03Z")

</div>

This seems to be a common problem. Is there documentation or an example someone could point me to?

My VEGA schema contains a format for non-aggregate query results

```auto
  data: {
    url: {
      index: myIndex
      "body": {
        "size": 10, "_source": ["objectField", "dateField"]
      }
    },
    "format": {"property": "hits.hits"}
  }

```

So the VEGA Debug portion shows the \_source field in the table as expected.

```auto
  "hits": {
    "total": 7,
    "max_score": 1,
    "hits": [
      {
        "_index": "myIndex",
        "_id": "20250824",
        "_score": 1,
        "_source": {
          "dateField": "2025-08-24T00:00:00Z",
          "objectField": [
            {
              "count": 9298,
              "id": "202509011839-0"
            },
            {
              "count": 8512,
              "id": "202509011038-0"
            },

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/2/62142d056a6e46979c9be9f61ae186e988418625.png)

Naturally, we would like to unpack this data using a transform. The \_source field is an array of objects, and datum allows us to access the VEGA debug’s table column names. So let’s try using the project transformation.

```auto
  transform: [
    {
      "type": "project",
      "fields": [
        "datum._source.dateField",
        "datum._source.objectField",
      ],
      "as": ["dateField", "objectField"]
    }
  ]

```

My problem is I expect to see the new object fields in my VEGA debug, but nothing changed.

I’ve also tried calculate as suggested in [Vega Boxplot - referencing properties in \_source (infinite extent error)](https://discuss.elastic.co/t/vega-boxplot-referencing-properties-in-source-infinite-extent-error/304696)

```auto
    {
      calculate: "datum._source.dateField",
      as: "dateField"
    }

```

But still, nothing happens.
