# Understanding transform stats

**URL:** <https://discuss.elastic.co/t/understanding-transform-stats/343053>\
**Category:** Elasticsearch\
**Tags:** transforms\
**Created:** [September 14, 2023, 12:41pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053 "2023-09-14T12:41:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulsy](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@pulsy](https://discuss.elastic.co/u/pulsy)\
**Post date:** [September 14, 2023, 12:41pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053/1 "2023-09-14T12:41:19Z")

</div>

I am currently in the process of figuring out how to implement a transform on a quite large index.

Especially the monitoring part of it is a bit puzzling for me. For example, the `search_time_in_ms` on the transform currently shows `48167249` which seems quite slow.

However, there are no slow query warnings on the elasticsearch nodes that run the transform. Also, when i open the "preview" tab of the transform in elastic, the result is shown immediately, i can also pageinate through the preview quite quickly.

According to the docs, the value represents "The amount of time spent searching, in milliseconds.", but what does this mean exactly?

The mean/average time it spent searching over all past searches? Is it a single search query duration?

---

<div class="post-metadata">

**Author:** ![greco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greco/32/106815_2.png) [@greco](https://discuss.elastic.co/u/greco)\
**Post date:** [September 14, 2023, 2:44pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053/2 "2023-09-14T14:44:21Z")

</div>

Hey @pulsy ,  
What version are you on ?

Can you post here the full output of the [GET transform statistics API](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html) ?

---

<div class="post-metadata">

**Author:** ![pulsy](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@pulsy](https://discuss.elastic.co/u/pulsy)\
**Post date:** [September 14, 2023, 3:12pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053/3 "2023-09-14T15:12:46Z")

</div>

hi @greco - sure:

```auto
{
  "count" : 1,
  "transforms" : [
    {
      "id" : "prepare-events",
      "state" : "indexing",
      "stats" : {
        "pages_processed" : 71037,
        "documents_processed" : 41864978,
        "documents_indexed" : 41698701,
        "documents_deleted" : 0,
        "trigger_count" : 204,
        "index_time_in_ms" : 6813652,
        "index_total" : 35200,
        "index_failures" : 0,
        "search_time_in_ms" : 55956129,
        "search_total" : 71038,
        "search_failures" : 0,
        "processing_time_in_ms" : 649302,
        "processing_total" : 71037,
        "delete_time_in_ms" : 0,
        "exponential_avg_checkpoint_duration_ms" : 1038350.2659654395,
        "exponential_avg_documents_indexed" : 1320182.8309541699,
        "exponential_avg_documents_processed" : 1343300.0856498873
      },
      "checkpointing" : {
        "last" : {
          "checkpoint" : 4,
          "timestamp_millis" : 1694619620033,
          "time_upper_bound_millis" : 1694619560033
        },
        "next" : {
          "checkpoint" : 5,
          "position" : {
            "bucket_position" : {
              "owner" : "74ddb173-f6c6-486c-bda7-59bcf520f1ac",
              "messageId" : "20ed1061-47f9-11ee-8b38-557f4528ee56"
            }
          },
          "checkpoint_progress" : {
            "docs_indexed" : 34229377,
            "docs_processed" : 34233071
          },
          "timestamp_millis" : 1694625075312,
          "time_upper_bound_millis" : 1694625015312
        },
        "operations_behind" : 13747650,
        "changes_last_detected_at" : 1694696169593,
        "last_search_time" : 1694696169593
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![greco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greco/32/106815_2.png) [@greco](https://discuss.elastic.co/u/greco)\
**Post date:** [September 14, 2023, 3:55pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053/4 "2023-09-14T15:55:19Z")

</div>

> According to the docs, the value represents "The amount of time spent searching, in milliseconds.", but what does this mean exactly?

That's a good question 🙂

`search_time_in_ms` is the **sum of all search times** , so it's a strictly growing quantity.  
To obtain the average search time, you must divide it by `search_total`, which in your case gives:  
55956129 / 71037 = **788 milliseconds** in average to perform a search.

* * *

If you still think this is too slow (and especially if you observe that `operations_behind` tends to grow),  
you can try and optimise your transform using the [Profile Search API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html) .

To do so, you need to rewrite your transform as a standalone search query :

This can be done by taking the relevant sections from the transform configuration and then by creating a search query (reuse the source query and aggregations where the top aggregation is based on the _group\_by_ of the transform and the aggregations part are sub-aggregations).

Hope that helps, good luck with profiling !

---

<div class="post-metadata">

**Author:** ![pulsy](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@pulsy](https://discuss.elastic.co/u/pulsy)\
**Post date:** [September 14, 2023, 6:22pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053/5 "2023-09-14T18:22:59Z")

</div>

That clarifies a lot, thanks for your help!

---

<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:** [October 12, 2023, 6:23pm UTC](https://discuss.elastic.co/t/understanding-transform-stats/343053/6 "2023-10-12T18:23:29Z")

</div>

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