# Problem creating transforms

**URL:** https://discuss.elastic.co/t/problem-creating-transforms/210701
**Category:** Elasticsearch
**Tags:** elastic-stack-machine-learning
**Created:** [December 5, 2019, 12:15pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701 "2019-12-05T12:15:12Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 5, 2019, 12:15pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/1 "2019-12-05T12:15:12Z")

</div>

Hi,

I upgraded by cluster to version 7.5 and I'm trying the Transforms from Kibana but I'm having some problem that I cannot identify.

The big picture is that when I create a continuous transform with more than 4-5 aggregations, the transform is created but not the index and it can't be started. When it happens and I click on the "Start" button, the only message I receive is:

"An error occurred starting the transform XXX"

with no further detail...

I've tried creating exactly the same transform (same configuration) and changing the number of aggregations: 1, 2, 3... My final goal is creating one with 13 aggregations but I could never create any transform with more than 4 aggregations.

I also checked that is not a problem with the fields I'm aggregating, because for example, if I create 1 transform with:

- avg(field1)
- sum(field1)
- avg(field2)
- sum(field2)
- avg(field3)
- sum(field3)
- avg(field4)
- sum(field4)

It always fails, but if I do 2 transforms with the same aggregations splitted into fields1-2 and fields3-4, then both transforms works normally.

Is there some limitations in the number of transforms supported?

Note: I'm using Elastic Service

Thanks in advance!!!

---

<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 5, 2019, 1:01pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/2 "2019-12-05T13:01:33Z")

</div>

Hi,

there is no limitation in the number of aggregations. Therefore it seems your transform fails for other reasons.

The destination index is created on start, not as part of creating the transform. On start transform checks whether the destination index exists and creates it if not. It would be good to know if the destination index gets created or not.

To further debug your issue:

Can you check the message tab of your job, you can find it in the jobs list after expanding the view, for example:

 ![Screenshot_20191205_135433](https://us1.discourse-cdn.com/elastic/original/3X/6/6/66c026e2406846f89da70236ecd6f5952d4d1c3c.png)

In addition it would be useful if you can query for transform stats in the dev console like this:

```auto
GET _transform/{your_failing_transform}/_stats

```

The output of this command should contain the failure reason.

Please let me know about your findings.

---

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 5, 2019, 3:20pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/3 "2019-12-05T15:20:17Z")

</div>

Hi Hendrik,

Thanks for your reply.

The index never is created and I double checked that there is no index with that name as you can see in the following images:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/1/b1ad920ffd76b3fbc60a539a4fe9cd4262ff3102.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/9/29b35e1ef16d0b33cdb4abb9b0b59d08cd5d79af.png)

So, I guess the problem is at index creation, but I can't figure out the reason because there is no error message:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/1/31e2c55168403d323c20907285c8795f09d46f2b.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/4/14d4fb33facfc8e1eaf0c5f641c93fc13044d003.png)

Is there anything else I can check to find the error?

Thanks!

---

<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 5, 2019, 7:12pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/4 "2019-12-05T19:12:29Z")

</div>

Hi,

the error happens when transforms creates the index (the audit message is send right before the index creation).

Can you start the transform via the dev console and send me the output:

```auto
POST _transform/orders_by_cutomers_min/_start 

```

The full error should be in the response.

---

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 6, 2019, 8:11am UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/5 "2019-12-06T08:11:45Z")

</div>

Hi Hendrik,

This is the error from the Dev console:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/9/396f3b3bd321e8947240da8c67e479f576d175d3.png)

I checked the mapping of that field and it is a float field:

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/e/fe7b5aef5cdca9d472f604a33f795553b4f34869.png)

In fact, during my tests, I created other continuous transforms with the same aggregations for that field and they work perfectly:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/8/f852e27a2ebcf65da3fdc6d28ea38eed771374d2.png)

Further, the Preview of the transform that is failling does also work:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/b/7b38a72b369e863d6597a0e25ac251ecb68d0813.png)

Any idea?

Many thanks!

---

<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 6, 2019, 8:42am UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/6 "2019-12-06T08:42:10Z")

</div>

Good morning!

We are getting closer, thanks for your patience.

The error means in a nutshell that transform tries to create a destination index with a field `subtotal_price` of some simple type and a nested field `subtotal_price.something`, so basically an object with another field in it.

I tried to reproduce your problem: for me the UI errors for such a mapping conflict on preview. I would like to find out, why for you it does not, seems like a special case.

Can you share your configuration, e.g. for the preview, you find a copy method on the upper right corner of your preview in the UI:

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/6/866192eef2932c98e5d4a8d1d04afa9eefccc241.png)

FWIW: As a workaround you can rename all your nested fields, e.g `subtotal_price.avg` to `subtotal_price_avg`.

---

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 6, 2019, 9:39am UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/7 "2019-12-06T09:39:23Z")

</div>

Hi Hendrik,

Thank you for your patient and your time.

Here is the configuration os the "source index preview":

```
GET orders/_search
{
  "query": {
    "bool": {
      "must_not": {
        "bool": {
          "should": [
            {
              "exists": {
                "field": "cancelled_at"
              }
            }
          ],
          "minimum_should_match": 1
        }
      }
    }
  }
}

```

And, this is the full transform:

```
POST _transform/_preview
{
  "source": {
    "index": [
      "orders"
    ],
    "query": {
      "bool": {
        "must_not": {
          "bool": {
            "should": [
              {
                "exists": {
                  "field": "cancelled_at"
                }
              }
            ],
            "minimum_should_match": 1
          }
        }
      }
    }
  },
  "pivot": {
    "group_by": {
      "customer.email.keyword": {
        "terms": {
          "field": "customer.email.keyword"
        }
      }
    },
    "aggregations": {
      "subtotal_price.avg": {
        "avg": {
          "field": "subtotal_price"
        }
      },
      "subtotal_price.sum": {
        "sum": {
          "field": "subtotal_price"
        }
      },
      "total_discounts.avg": {
        "avg": {
          "field": "total_discounts"
        }
      },
      "total_discounts.sum": {
        "sum": {
          "field": "total_discounts"
        }
      },
      "total_price.avg": {
        "avg": {
          "field": "total_price"
        }
      },
      "total_price.sum": {
        "sum": {
          "field": "total_price"
        }
      },
      "customer.orders_count.max": {
        "max": {
          "field": "customer.orders_count"
        }
      }
    }
  }
}

```

Cheers

---

<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 6, 2019, 10:12am UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/8 "2019-12-06T10:12:13Z")

</div>

Hi,

can you send me the output of the preview call, after you executed it in the dev console? It returns the mappings it would use to create the destination index.

I see nothing wrong with your config. This is a transform that fails on start for you?

---

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 6, 2019, 10:30am UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/9 "2019-12-06T10:30:05Z")

</div>

Sure, here it is:

```
{
  "preview" : [
    {
      "total_discounts" : {
        "avg" : 0.0,
        "sum" : 0.0
      },
      "subtotal_price" : {
        "avg" : 323.0,
        "sum" : 323.0
      },
      "total_price" : {
        "avg" : 323.0,
        "sum" : 323.0
      },
      "customer" : {
        "orders_count" : {
          "max" : 1.0
        },
        "email" : {
          "keyword" : "XXXXX"
        }
      }
    },
    {...rest of the results...}
  ],
  "mappings" : {
    "properties" : {
      "total_discounts.sum" : {
        "type" : "double"
      },
      "subtotal_price.sum" : {
        "type" : "double"
      },
      "total_price.sum" : {
        "type" : "double"
      },
      "total_price.avg" : {
        "type" : "double"
      },
      "customer.email.keyword" : {
        "type" : "keyword"
      },
      "total_discounts.avg" : {
        "type" : "double"
      },
      "customer.orders_count.max" : {
        "type" : "long"
      },
      "subtotal_price.avg" : {
        "type" : "double"
      }
    }
  }
}

```

Many thanks!!

---

<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 6, 2019, 11:15am UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/10 "2019-12-06T11:15:45Z")

</div>

Hi,

the mappings look fine, however there might be another source for conflicting mappings: index templates.

To find out, you can try to create your problematic transform with a destination index not starting with the prefix `orders`, for example `transform_orders_by_customers_min`?

If that still fails and/or to check whether the suspicion is correct, can you get the index templates with:

```auto
GET /_template

```

and look for templates that start with `orders` or a template that would match `orders`, e.g. a template for `*`? The pattern is defined in the field `index_patterns` of the individual templates.

---

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 6, 2019, 12:28pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/11 "2019-12-06T12:28:26Z")

</div>

Your are great, Hendrik!! That was the problem.

There is one template that is affecting the final mapping, although I don't know exactly why.

I checked all my templates and find the only one that matches the index name and review the mapping and it looks OK to me (I keep just the fields that I'm using for grouping and aggregating):

```
[...]
    "index_patterns" : [
      "orders*"
    ],
[...]
"mappings" : {
  "properties" : {
    [...]
    "subtotal_price" : {
      "type" : "float"
    },
    "total_discounts" : {
      "type" : "float"
    },
    "total_price" : {
      "type" : "float"
    },
    "customer" : {
      "properties" : {
        "orders_count" : {
          "type" : "long"
        },
        "email" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "ignore_above" : 256,
              "type" : "keyword"
            }
          }
        },
        [...]
    },
    [...]

```

If you know the reason, please share it with me.

In any way, thanks a lot for helping me with this!!!

---

<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 6, 2019, 12:48pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/12 "2019-12-06T12:48:34Z")

</div>

The problem is that the template defines:

```auto
{
    "subtotal_price" : {
        "type" : "float"
    },
}

```

which in json would be for example:

```auto
{
    "subtotal_price": 55
}

```

but in the transform you create:

```auto
{
    "subtotal_price.sum" : {
        "type" : "double"
    },
    "subtotal_price.avg" : {
        "type" : "double"
    }
}

```

which in json looks like this:

```auto
{
    "subtotal_price": {
        "sum": 100,
        "avg": 23
    }
}

```

As you can see `sum` and `avg` are nested objects of `subtotal_price`. You can not have something that is a number and an object at the same time.

I admit the error message is quite cryptic and it would be nice if request validation would have found this problem before `_start`.

Several usability issues have been found thanks to you. I will follow up and put them on the backlog for upcoming releases.

---

<div class="post-metadata">

### Author: ![JulGor](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JulGor](https://discuss.elastic.co/u/JulGor)
#### Post date: [December 6, 2019, 9:54pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/13 "2019-12-06T21:54:40Z")

</div>

Now I got it.

Thanks again for your help and your time!

---

<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 3, 2020, 9:54pm UTC](https://discuss.elastic.co/t/problem-creating-transforms/210701/14 "2020-01-03T21:54:44Z")

</div>

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