# String to nested type, possible?

**URL:** <https://discuss.elastic.co/t/string-to-nested-type-possible/230712>\
**Category:** Elasticsearch\
**Created:** [May 1, 2020, 1:08pm UTC](https://discuss.elastic.co/t/string-to-nested-type-possible/230712 "2020-05-01T13:08:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![karimelc](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@karimelc](https://discuss.elastic.co/u/karimelc)\
**Post date:** [May 1, 2020, 1:08pm UTC](https://discuss.elastic.co/t/string-to-nested-type-possible/230712/1 "2020-05-01T13:08:19Z")

</div>

Hi,

I have an existing index where the field items looks like:

```auto
"items": "{"productA":{"qty":3},"productB":{"qty":5},"productC":{"qty":9}}"

```

The field items is mapped as type text. The field items can contain any number of products (productA, productB etc.).

Is it possible to use a pipeline processor or transform job or similar to convert the string items to a nested datatype so that I can perform aggregations on it?

The nested field should look something like:

```auto
  "items": [
    {
      "product": "A",
      "qty": 3
    },
    {
      "product": "B",
      "qty": 5
    },
    { "product": "C",
      "qty": 9
    }
  ]

```

---

<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:** [May 29, 2020, 1:08pm UTC](https://discuss.elastic.co/t/string-to-nested-type-possible/230712/2 "2020-05-29T13:08:21Z")

</div>

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