# ElasticSearch Transform Not Working

**URL:** <https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123>\
**Category:** Elasticsearch\
**Created:** [February 5, 2025, 11:10am UTC](https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123 "2025-02-05T11:10:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![loverissimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loverissimo/32/141356_2.png) [@loverissimo](https://discuss.elastic.co/u/loverissimo)\
**Post date:** [February 5, 2025, 11:10am UTC](https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123/1 "2025-02-05T11:10:06Z")

</div>

Hello, hope you can help me with a transform issue. I have this sales index that as an id, timestamp and value fields and Im working on another index (sales-latest) that dynamically searches for unique ids and the most recent timestamps of that id (all this from the sales index). I'm anexing the scripts below:

```auto
PUT sales-latest
{
  "mappings": {
    "properties": {
      "id": { "type": "keyword" },
      "timestamp": { "type": "date" }
    }
  }
}

PUT _transform/sales-latest
{
  "frequency": "5s",
  
  "sync": {
    "time": {
       "field": "timestamp",
       "delay": "60s"
     }
  },
  
  "source": {
    "index": "sales"
  },
  "dest": {
    "index": "sales-latest"
  },
  "pivot": {
    "group_by": {
      "id": {
        "terms": {
          "field": "id"
        }
      }
    },
    "aggregations": {
      "timestamp": {
        "max": {
          "field": "timestamp"
        }
      }
    }
  }
} 

```

When I execute the \_start query it works the first time but everytime I insert a new id or an entry with a more recent timestamp for a specific id it does not update.  
Could you help me?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 9, 2025, 1:33am UTC](https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123/2 "2025-02-09T01:33:27Z")

</div>

Hi @loverissimo Welcome to the community.

> [@loverissimo](#):
>
> I have this sales index that as an id, timestamp and value fields and Im working on another index (sales-latest) that dynamically searches for unique ids and the most recent timestamps of that id (all this from the sales index).

What you are describing sounds like a `latest` transform, not a `pivot` transform

If you want a resulting index that shows the last time a transaction was made by `id`, that is a latest transform ... it will keep the whole entry so you will also have the values of that latest entry.

So in your case that would look something like this... I would use the UI the first time.

 ![Screenshot 2025-02-08 at 5.28.59 PM](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8c50cfef2fe66b3bde9232ec7819ee9559ec9518.png)

```auto
PUT _transform/sales-latest
{
  "source": {
    "index": [
      "sales"
    ],
    "query": {
      "match_all": {}
    }
  },
  "dest": {
    "index": "sales-latest"
  },
  "latest": {
    "unique_key": [
      "id"
    ],
    "sort": "@timestamp"
}

```

---

<div class="post-metadata">

**Author:** ![loverissimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loverissimo/32/141356_2.png) [@loverissimo](https://discuss.elastic.co/u/loverissimo)\
**Post date:** [February 13, 2025, 11:43am UTC](https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123/3 "2025-02-13T11:43:08Z")

</div>

Hi, thank you for the response. That is not quite what I'm looking for, I want the transform to dynamically update the new index everytime a new entry is saved in the source index, I tried thta script and it did not worked. It is probably my Basic License

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 13, 2025, 11:47am UTC](https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123/5 "2025-02-13T11:47:42Z")

</div>

> [@loverissimo](#):
>
> That is not quite what I'm looking for, I want the transform to dynamically update the new index everytime a new entry is saved in the source index

If you look in [the documentation around transform limitations](https://www.elastic.co/guide/en/elasticsearch/reference/current/transform-limitations.html#transform-scheduling-limitations) you can see that even continuous transforms run on a schedule. Updates will therefore most of the time come with a delay.

---

<div class="post-metadata">

**Author:** ![loverissimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loverissimo/32/141356_2.png) [@loverissimo](https://discuss.elastic.co/u/loverissimo)\
**Post date:** [February 13, 2025, 12:15pm UTC](https://discuss.elastic.co/t/elasticsearch-transform-not-working/374123/6 "2025-02-13T12:15:28Z")

</div>

I have tried waiting for the 60s delay to even 5min. Does it usually take more than that?
