get-transform-stats.asciidoc 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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. `checkpointing`.`operations_behind`:::
  82. (integer) The number of operations that have occurred on the source index but
  83. have not been applied to the destination index yet. A high number can indicate
  84. that the {transform} is failing to keep up.
  85. `id`::
  86. (string)
  87. include::{docdir}/rest-api/common-parms.asciidoc[tag=transform-id]
  88. `node`::
  89. (object) For started {transforms} only, the node upon which the {transform} is
  90. started.
  91. `node`.`attributes`:::
  92. (object) A list of attributes for the node.
  93. `node`.`ephemeral_id`:::
  94. (string) The node ephemeral ID.
  95. `node`.`id`:::
  96. (string) The unique identifier of the node. For example, "0-o0tOoRTwKFZifatTWKNw".
  97. `node`.`name`:::
  98. (string) The node name. For example, `0-o0tOo`.
  99. `node`.`transport_address`:::
  100. (string) The host and port where transport HTTP connections are accepted. For
  101. example, `127.0.0.1:9300`.
  102. `state`::
  103. (string) The status of the {transform}, which can be one of the following values:
  104. +
  105. --
  106. * `aborting`: The {transform} is aborting.
  107. * `failed`: The {transform} failed. For more information about the failure,
  108. check the reason field.
  109. * `indexing`: The {transform} is actively processing data and creating new
  110. documents.
  111. * `started`: The {transform} is running but not actively indexing data.
  112. * `stopped`: The {transform} is stopped.
  113. * `stopping`: The {transform} is stopping.
  114. --
  115. `stats`::
  116. (object) An object that provides statistical information about the {transform}.
  117. `stats`.`documents_indexed`:::
  118. (long) The number of documents that have been indexed into the destination index
  119. for the {transform}.
  120. `stats`.`documents_processed`:::
  121. (long) The number of documents that have been processed from the source index of
  122. the {transform}.
  123. `stats`.`exponential_avg_checkpoint_duration_ms`:::
  124. (double) Exponential moving average of the duration of the checkpoint, in milliseconds.
  125. `stats`.`exponential_avg_documents_indexed`:::
  126. (double) Exponential moving average of the number of new documents that have been
  127. indexed.
  128. `stats`.`exponential_avg_documents_processed`:::
  129. (double) Exponential moving average of the number of documents that have been
  130. processed.
  131. `stats`.`index_failures`:::
  132. (long) The number of indexing failures.
  133. `stats`.`index_time_in_ms`:::
  134. (long) The amount of time spent indexing, in milliseconds.
  135. `stats`.`index_total`:::
  136. (long) The number of indices created.
  137. `stats`.`pages_processed`:::
  138. (long) The number of search or bulk index operations processed. Documents are
  139. processed in batches instead of individually.
  140. `stats`.`search_failures`:::
  141. (long) The number of search failures.
  142. `stats`.`search_time_in_ms`:::
  143. (long) The amount of time spent searching, in milliseconds.
  144. `stats`.`search_total`:::
  145. (long) The number of search operations on the source index for the {transform}.
  146. `stats`.`trigger_count`:::
  147. (long) The number of times the {transform} has been triggered by the scheduler.
  148. For example, the scheduler triggers the {transform} indexer to check for updates
  149. or ingest new data at an interval specified in the
  150. <<put-transform-request-body,`frequency` property>>.
  151. [[get-transform-stats-response-codes]]
  152. ==== {api-response-codes-title}
  153. `404` (Missing resources)::
  154. If `allow_no_match` is `false`, this code indicates that there are no
  155. resources that match the request or only partial matches for the request.
  156. [[get-transform-stats-example]]
  157. ==== Examples
  158. The following example skips for the first five {transforms} and
  159. gets usage information for a maximum of ten results:
  160. [source,console]
  161. --------------------------------------------------
  162. GET _transform/_stats?from=5&size=10
  163. --------------------------------------------------
  164. // TEST[skip:todo]
  165. The following example gets usage information for the `ecommerce_transform`
  166. {transform}:
  167. [source,console]
  168. --------------------------------------------------
  169. GET _transform/ecommerce_transform/_stats
  170. --------------------------------------------------
  171. // TEST[skip:todo]
  172. The API returns the following results:
  173. [source,console-result]
  174. ----
  175. {
  176. "count" : 1,
  177. "transforms" : [
  178. {
  179. "id" : "ecommerce_transform",
  180. "state" : "indexing",
  181. "stats" : {
  182. "pages_processed" : 2,
  183. "documents_processed" : 1220,
  184. "documents_indexed" : 13,
  185. "trigger_count" : 1,
  186. "index_time_in_ms" : 19,
  187. "index_total" : 1,
  188. "index_failures" : 0,
  189. "search_time_in_ms" : 52,
  190. "search_total" : 2,
  191. "search_failures" : 0,
  192. "exponential_avg_checkpoint_duration_ms" : 77,
  193. "exponential_avg_documents_indexed" : 2,
  194. "exponential_avg_documents_processed" : 12
  195. },
  196. "checkpointing" : {
  197. "last" : {
  198. "checkpoint" : 100,
  199. "timestamp_millis" : 1561740252497,
  200. "time_upper_bound_millis" : 1561740192497
  201. },
  202. "next" : {
  203. "checkpoint" : 101,
  204. "position" : {
  205. "indexer_position" : {
  206. "hashtag" : "abcd1234"
  207. },
  208. "buckets_position" : {
  209. "hashtag" : "abcd5678"
  210. }
  211. },
  212. "checkpoint_progress" : {
  213. "documents_processed": 100,
  214. "documents_indexed": 1
  215. },
  216. "changes_last_detected_at": 1561740629170,
  217. "timestamp_millis" : 1561740629172,
  218. "time_upper_bound_millis" : 1561740569172
  219. },
  220. "operations_behind": 27000
  221. }
  222. }
  223. ]
  224. }
  225. ----