# Elastic search transform not working on nested fields

**URL:** https://discuss.elastic.co/t/elastic-search-transform-not-working-on-nested-fields/321649
**Category:** Elasticsearch
**Created:** [December 20, 2022, 1:20pm UTC](https://discuss.elastic.co/t/elastic-search-transform-not-working-on-nested-fields/321649 "2022-12-20T13:20:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pranay\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranay_jain/32/92747_2.png) [@pranay\_jain](https://discuss.elastic.co/u/pranay_jain)
#### Post date: [December 20, 2022, 1:20pm UTC](https://discuss.elastic.co/t/elastic-search-transform-not-working-on-nested-fields/321649/1 "2022-12-20T13:20:14Z")

</div>

Hi,  
I have an index which looks like below

```auto
"properties": {
  "employee_id": {
    "type": "long"
  },
  "employee_details": {
    "type": "nested",
    "dynamic": "false",
    "properties": {
      "city": {
        "type": "keyword"
      },
      "employee_type": {
        "type": "keyword"
      }
    }
  }
}

```

I want to summarize the data from source index, summarize it and then create a new index. I understand that I can create _transforms_ and below is how I am trying to create it.

```auto
{
  "source": {
    "index": "employee_index"
  },
  "pivot": {
    "group_by": {
      "id": {
        "nested": {
          "path": "employee_details"
        },
        "terms": {
          "field": "employee_details.city"
        }
      }
    },
    "aggregations": {
      "count_id": {
        "nested": {
          "path": "employee_details"
        },
        "value_count": {
          "field": "employee_details.employee_type"
        }
      }
    }
  },
  "dest": {
    "index": "employee_summary"
  },
  "frequency": "1d"
}

```

When I try to create a transform, I am getting following error

```auto
No enum constant org.elasticsearch.xpack.core.transform.transforms.pivot.SingleGroupSource.Type.NESTED

```

What does this mean?  
Is transform not supported for the nested fields?

---

<div class="post-metadata">

### Author: ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)
#### Post date: [December 21, 2022, 7:10am UTC](https://discuss.elastic.co/t/elastic-search-transform-not-working-on-nested-fields/321649/2 "2022-12-21T07:10:51Z")

</div>

Transform does not support a `group_by` of type `nested`. This:

```auto
"pivot": {
    "group_by": {
      "id": {
        "nested": {
          "path": "employee_details"
        },

```

is not possible. Neither it is possible to use a `nested` aggregation as part of `aggregations`. You can find the list of supported aggregations in the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html).

---

<div class="post-metadata">

### Author: ![pranay\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranay_jain/32/92747_2.png) [@pranay\_jain](https://discuss.elastic.co/u/pranay_jain)
#### Post date: [December 21, 2022, 9:45am UTC](https://discuss.elastic.co/t/elastic-search-transform-not-working-on-nested-fields/321649/3 "2022-12-21T09:45:31Z")

</div>

Thank you for the info !

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 18, 2023, 9:45am UTC](https://discuss.elastic.co/t/elastic-search-transform-not-working-on-nested-fields/321649/4 "2023-01-18T09:45:59Z")

</div>

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