get-transform-stats.asciidoc 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[get-transform-stats]]
  4. === Get {transform} statistics API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Get {transform} statistics</titleabbrev>
  8. ++++
  9. Retrieves usage information for {transforms}.
  10. [[get-transform-stats-request]]
  11. ==== {api-request-title}
  12. `GET _transform/<transform_id>/_stats`
  13. `GET _transform/<transform_id>,<transform_id>/_stats` +
  14. `GET _transform/_stats` +
  15. `GET _transform/_all/_stats` +
  16. `GET _transform/*/_stats` +
  17. [[get-transform-stats-prereqs]]
  18. ==== {api-prereq-title}
  19. * If the {es} {security-features} are enabled, you must have `monitor_transform`
  20. cluster privileges to use this API. The built-in `transform_user` role has these
  21. privileges. For more information, see <<security-privileges>> and
  22. <<built-in-roles>>.
  23. [[get-transform-stats-desc]]
  24. ==== {api-description-title}
  25. You can get statistics for multiple {transforms} in a single API
  26. request by using a comma-separated list of identifiers or a wildcard expression.
  27. You can get statistics for all {transforms} by using `_all`, by
  28. specifying `*` as the `<transform_id>`, or by omitting the
  29. `<transform_id>`.
  30. [[get-transform-stats-path-parms]]
  31. ==== {api-path-parms-title}
  32. `<transform_id>`::
  33. (Optional, string)
  34. include::{docdir}/rest-api/common-parms.asciidoc[tag=transform-id-wildcard]
  35. [[get-transform-stats-query-parms]]
  36. ==== {api-query-parms-title}
  37. `allow_no_match`::
  38. (Optional, boolean)
  39. include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-match-transforms1]
  40. `from`::
  41. (Optional, integer)
  42. include::{docdir}/rest-api/common-parms.asciidoc[tag=from-transforms]
  43. `size`::
  44. (Optional, integer)
  45. include::{docdir}/rest-api/common-parms.asciidoc[tag=size-transforms]
  46. [[get-transform-stats-response]]
  47. ==== {api-response-body-title}
  48. The API returns an array of statistics objects for {transforms}, which are
  49. sorted by the `id` value in ascending order. All of these properties are
  50. informational; you cannot update their values.
  51. `checkpointing`::
  52. (object) Contains statistics about <<transform-checkpoints,checkpoints>>.
  53. `checkpointing`.`changes_last_detected_at`:::
  54. (date) The timestamp when changes were last detected in the source indices.
  55. `checkpointing`.`last`:::
  56. (object) Contains statistics about the last completed checkpoint.
  57. `checkpointing`.`last`.`checkpoint`::::
  58. (integer) The sequence number for the checkpoint.
  59. `checkpointing`.`last`.`time_upper_bound_millis`::::
  60. (date) When using time-based synchronization, this timestamp indicates the
  61. upper bound of data that is included in the checkpoint.
  62. `checkpointing`.`last`.`timestamp_millis`::::
  63. (date) The timestamp of the checkpoint, which indicates when the checkpoint
  64. was created.
  65. `checkpointing`.`next`:::
  66. (object) Contains statistics about the next checkpoint that is currently in
  67. progress. This object appears only when the {transform} `state` is `indexing`.
  68. `checkpointing`.`next`.`checkpoint`::::
  69. (integer) The sequence number for the checkpoint.
  70. `checkpointing`.`next`.`checkpoint_progress`::::
  71. (object) Contains statistics about the progress of the checkpoint. For example,
  72. it lists the `total_docs`, `docs_remaining`, `percent_complete`,
  73. `docs_processed`, and `docs_indexed`. This information is available only for
  74. batch {transforms} and the first checkpoint of {ctransforms}.
  75. `checkpointing`.`next`.`time_upper_bound_millis`::::
  76. (date) When using time-based synchronization, this timestamp indicates the
  77. upper bound of data that is included in the checkpoint.
  78. `checkpointing`.`next`.`timestamp_millis`::::
  79. (date) The timestamp of the checkpoint, which indicates when the checkpoint was
  80. created.
  81. `id`::
  82. (string)
  83. include::{docdir}/rest-api/common-parms.asciidoc[tag=transform-id]
  84. `node`::
  85. (object) For started {transforms} only, the node upon which the {transform} is
  86. started.
  87. `node`.`attributes`:::
  88. (object) A list of attributes for the node.
  89. `node`.`ephemeral_id`:::
  90. (string) The node ephemeral ID.
  91. `node`.`id`:::
  92. (string) The unique identifier of the node. For example, "0-o0tOoRTwKFZifatTWKNw".
  93. `node`.`name`:::
  94. (string) The node name. For example, `0-o0tOo`.
  95. `node`.`transport_address`:::
  96. (string) The host and port where transport HTTP connections are accepted. For
  97. example, `127.0.0.1:9300`.
  98. `state`::
  99. (string) The status of the {transform}, which can be one of the following values:
  100. +
  101. --
  102. * `aborting`: The {transform} is aborting.
  103. * `failed`: The {transform} failed. For more information about the failure,
  104. check the reason field.
  105. * `indexing`: The {transform} is actively processing data and creating new
  106. documents.
  107. * `started`: The {transform} is running but not actively indexing data.
  108. * `stopped`: The {transform} is stopped.
  109. * `stopping`: The {transform} is stopping.
  110. --
  111. `stats`::
  112. (object) An object that provides statistical information about the {transform}.
  113. `stats`.`documents_indexed`:::
  114. (long) The number of documents that have been indexed into the destination index
  115. for the {transform}.
  116. `stats`.`documents_processed`:::
  117. (long) The number of documents that have been processed from the source index of
  118. the {transform}.
  119. `stats`.`exponential_avg_checkpoint_duration_ms`:::
  120. (double) Exponential moving average of the duration of the checkpoint, in milliseconds.
  121. `stats`.`exponential_avg_documents_indexed`:::
  122. (double) Exponential moving average of the number of new documents that have been
  123. indexed.
  124. `stats`.`exponential_avg_documents_processed`:::
  125. (double) Exponential moving average of the number of documents that have been
  126. processed.
  127. `stats`.`index_failures`:::
  128. (long) The number of indexing failures.
  129. `stats`.`index_time_in_ms`:::
  130. (long) The amount of time spent indexing, in milliseconds.
  131. `stats`.`index_total`:::
  132. (long) The number of indices created.
  133. `stats`.`pages_processed`:::
  134. (long) The number of search or bulk index operations processed. Documents are
  135. processed in batches instead of individually.
  136. `stats`.`search_failures`:::
  137. (long) The number of search failures.
  138. `stats`.`search_time_in_ms`:::
  139. (long) The amount of time spent searching, in milliseconds.
  140. `stats`.`search_total`:::
  141. (long) The number of search operations on the source index for the {transform}.
  142. `stats`.`trigger_count`:::
  143. (long) The number of times the {transform} has been triggered by the scheduler.
  144. For example, the scheduler triggers the {transform} indexer to check for updates
  145. or ingest new data at an interval specified in the
  146. <<put-transform-request-body,`frequency` property>>.
  147. [[get-transform-stats-response-codes]]
  148. ==== {api-response-codes-title}
  149. `404` (Missing resources)::
  150. If `allow_no_match` is `false`, this code indicates that there are no
  151. resources that match the request or only partial matches for the request.
  152. [[get-transform-stats-example]]
  153. ==== Examples
  154. The following example skips for the first five {transforms} and
  155. gets usage information for a maximum of ten results:
  156. [source,console]
  157. --------------------------------------------------
  158. GET _transform/_stats?from=5&size=10
  159. --------------------------------------------------
  160. // TEST[skip:todo]
  161. The following example gets usage information for the `ecommerce_transform`
  162. {transform}:
  163. [source,console]
  164. --------------------------------------------------
  165. GET _transform/ecommerce_transform/_stats
  166. --------------------------------------------------
  167. // TEST[skip:todo]
  168. The API returns the following results:
  169. [source,console-result]
  170. ----
  171. {
  172. "count" : 1,
  173. "transforms" : [
  174. {
  175. "id" : "ecommerce_transform",
  176. "state" : "indexing",
  177. "stats" : {
  178. "pages_processed" : 2,
  179. "documents_processed" : 1220,
  180. "documents_indexed" : 13,
  181. "trigger_count" : 1,
  182. "index_time_in_ms" : 19,
  183. "index_total" : 1,
  184. "index_failures" : 0,
  185. "search_time_in_ms" : 52,
  186. "search_total" : 2,
  187. "search_failures" : 0,
  188. "exponential_avg_checkpoint_duration_ms" : 77,
  189. "exponential_avg_documents_indexed" : 2,
  190. "exponential_avg_documents_processed" : 12
  191. },
  192. "checkpointing" : {
  193. "last" : {
  194. "checkpoint" : 100,
  195. "timestamp_millis" : 1561740252497,
  196. "time_upper_bound_millis" : 1561740192497
  197. },
  198. "next" : {
  199. "checkpoint" : 101,
  200. "position" : {
  201. "indexer_position" : {
  202. "hashtag" : "abcd1234"
  203. },
  204. "buckets_position" : {
  205. "hashtag" : "abcd5678"
  206. }
  207. },
  208. "checkpoint_progress" : {
  209. "documents_processed": 100,
  210. "documents_indexed": 1
  211. },
  212. "changes_last_detected_at": 1561740629170,
  213. "timestamp_millis" : 1561740629172,
  214. "time_upper_bound_millis" : 1561740569172
  215. },
  216. "operations_behind": 27000
  217. }
  218. }
  219. ]
  220. }
  221. ----