# Transform on fields of a nested object

**URL:** https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986
**Category:** Elasticsearch
**Created:** [June 13, 2020, 3:51pm UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986 "2020-06-13T15:51:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sharad\_khandelwal1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharad_khandelwal1/32/48680_2.png) [@sharad\_khandelwal1](https://discuss.elastic.co/u/sharad_khandelwal1)
#### Post date: [June 13, 2020, 3:51pm UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/1 "2020-06-13T15:51:17Z")

</div>

Does transform support group by on nested fields?

I was trying to group by on a field of a nested object but no results appear in the preview.

---

<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: [June 16, 2020, 6:54am UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/2 "2020-06-16T06:54:32Z")

</div>

Hi,

transform should support nested fields, I am not aware of a limitation. Your issue sounds like a bug. Can you post your configuration and some example data?

Did you try it in dev console? Did you try to create the transform despite preview not showing something?

What version are you on?

---

<div class="post-metadata">

### Author: ![sharad\_khandelwal1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharad_khandelwal1/32/48680_2.png) [@sharad\_khandelwal1](https://discuss.elastic.co/u/sharad_khandelwal1)
#### Post date: [June 16, 2020, 7:36pm UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/3 "2020-06-16T19:36:12Z")

</div>

Hi Hendrik,

ES Version: 7.7.1  
I tried using both KIbana and APIs. The generated index is empty.

Please see the mapping below. I was trying to join on the annotations.theme field.

FYI - This join field is optional hence not every document will have this

Mapping

```auto
        {
      "test2" : {
        "mappings" : {
          "properties" : {
            "_class" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "annotations" : {
              "type" : "nested",
              "properties" : {
                "sentiment" : {
                  "type" : "integer"
                },
                "theme" : {
                  "type" : "keyword"
                }
              }
            },
            "comment" : {
              "type" : "text"
            },
            "datetime" : {
              "type" : "date"
            },
            "externalId" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
            },
            "source" : {
              "type" : "keyword"
            },
            "title" : {
              "type" : "text"
            }
          }
        }
      }
    }

```

---

<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: [June 17, 2020, 8:22am UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/4 "2020-06-17T08:22:03Z")

</div>

Thanks, I misunderstood the question. I understood nested as in "nested object" but not "nested data type".

Aggregations on nested fields require the nested aggregation, so this is not a transform limitation, but a limitation in the aggregation framework. Transform is using composite aggregations, which does not support this case.

I doubt that we add support for it, because this has scalability issues. Un-nesting is limited but composite aggregations and transform are meant for bigger data sets.

Maybe you can change you input data layout or if the data is small just use an ordinary aggregation instead of a transform.

---

<div class="post-metadata">

### Author: ![sharad\_khandelwal1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharad_khandelwal1/32/48680_2.png) [@sharad\_khandelwal1](https://discuss.elastic.co/u/sharad_khandelwal1)
#### Post date: [June 17, 2020, 12:03pm UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/5 "2020-06-17T12:03:15Z")

</div>

Thanks! We are seeing similar issue in using the ML module i.e anomaly detection on a nested field.

Is the same limitation applicable there as well?

---

<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: [June 17, 2020, 1:45pm UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/6 "2020-06-17T13:45:47Z")

</div>

Can you open a new thread and elaborate a bit (config, sample data)?  
Are you using aggregations in the datafeed?

(Having that said, I guess you have a platinum license, so it might be better to go via support)

---

<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: [July 15, 2020, 1:46pm UTC](https://discuss.elastic.co/t/transform-on-fields-of-a-nested-object/236986/7 "2020-07-15T13:46:02Z")

</div>

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