overview.asciidoc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. [role="xpack"]
  2. [[transform-overview]]
  3. = {transform-cap} overview
  4. ++++
  5. <titleabbrev>Overview</titleabbrev>
  6. ++++
  7. You can choose either of the following methods to transform your data:
  8. <<pivot-transform-overview,pivot>> or <<latest-transform-overview,latest>>.
  9. IMPORTANT: All {transforms} leave your source index intact. They create a new
  10. index that is dedicated to the transformed data.
  11. {transforms-cap} are persistent tasks; they are stored in cluster state which
  12. makes them resilient for node failures. Refer to <<transform-checkpoints>> and
  13. <<ml-transform-checkpoint-errors>> to learn more about the machinery behind
  14. {transforms}.
  15. [[pivot-transform-overview]]
  16. == Pivot {transforms}
  17. You can use {transforms} to _pivot_ your data into a new entity-centric index.
  18. By transforming and summarizing your data, it becomes possible to visualize and
  19. analyze it in alternative and interesting ways.
  20. A lot of {es} indices are organized as a stream of events: each event is an
  21. individual document, for example a single item purchase. {transforms-cap} enable
  22. you to summarize this data, bringing it into an organized, more
  23. analysis-friendly format. For example, you can summarize all the purchases of a
  24. single customer.
  25. {transforms-cap} enable you to define a pivot, which is a set of
  26. features that transform the index into a different, more digestible format.
  27. Pivoting results in a summary of your data in a new index.
  28. To define a pivot, first you select one or more fields that you will use to
  29. group your data. You can select categorical fields (terms) and numerical fields
  30. for grouping. If you use numerical fields, the field values are bucketed using
  31. an interval that you specify.
  32. The second step is deciding how you want to aggregate the grouped data. When
  33. using aggregations, you practically ask questions about the index. There are
  34. different types of aggregations, each with its own purpose and output. To learn
  35. more about the supported aggregations and group-by fields, see
  36. <<put-transform>>.
  37. As an optional step, you can also add a query to further limit the scope of the
  38. aggregation.
  39. The {transform} performs a composite aggregation that paginates through all the
  40. data defined by the source index query. The output of the aggregation is stored
  41. in a _destination index_. Each time the {transform} queries the source index, it
  42. creates a _checkpoint_. You can decide whether you want the {transform} to run
  43. once or continuously. A _batch {transform}_ is a single operation that has a
  44. single checkpoint. _{ctransforms-cap}_ continually increment and process
  45. checkpoints as new source data is ingested.
  46. Imagine that you run a webshop that sells clothes. Every order creates a
  47. document that contains a unique order ID, the name and the category of the
  48. ordered product, its price, the ordered quantity, the exact date of the order,
  49. and some customer information (name, gender, location, etc). Your data set
  50. contains all the transactions from last year.
  51. If you want to check the sales in the different categories in your last fiscal
  52. year, define a {transform} that groups the data by the product categories
  53. (women's shoes, men's clothing, etc.) and the order date. Use the last year as
  54. the interval for the order date. Then add a sum aggregation on the ordered
  55. quantity. The result is an entity-centric index that shows the number of sold
  56. items in every product category in the last year.
  57. [role="screenshot"]
  58. image::images/pivot-preview.png["Example of a pivot {transform} preview in {kib}"]
  59. [[latest-transform-overview]]
  60. == Latest {transforms}
  61. You can use the `latest` type of {transform} to copy the most recent documents
  62. into a new index. You must identify one or more fields as the unique key for
  63. grouping your data, as well as a date field that sorts the data chronologically.
  64. For example, you can use this type of {transform} to keep track of the latest
  65. purchase for each customer or the latest event for each host.
  66. [role="screenshot"]
  67. image::images/latest-preview.png["Example of a latest {transform} preview in {kib}"]
  68. As in the case of a pivot, a latest {transform} can run once or continuously. It
  69. performs a composite aggregation on the data in the source index and stores the
  70. output in the destination index. If the {transform} runs continuously, new unique
  71. key values are automatically added to the destination index and the most recent
  72. documents for existing key values are automatically updated at each checkpoint.
  73. [[transform-performance]]
  74. == Performance considerations
  75. {transforms-cap} perform search aggregations on the source indices then index
  76. the results into the destination index. Therefore, a {transform} never takes
  77. less time or uses less resources than the aggregation and indexing processes.
  78. If your {transform} must process a lot of historic data, it has high resource
  79. usage initially--particularly during the first checkpoint.
  80. For better performance, make sure that your search aggregations and queries are
  81. optimized and that your {transform} is processing only necessary data. Consider
  82. whether you can apply a source query to the {transform} to reduce the scope of
  83. data it processes. Also consider whether the cluster has sufficient resources in
  84. place to support both the composite aggregation search and the indexing of its
  85. results.
  86. If you prefer to spread out the impact on your cluster (at the cost of a slower
  87. {transform}), you can throttle the rate at which it performs search and index
  88. requests. Set the `docs_per_second` limit when you <<put-transform,create>> or
  89. <<update-transform,update>> your {transform}. If you want to calculate the
  90. current rate, use the following information from the
  91. {ref}/get-transform-stats.html[get {transform} stats API]:
  92. ```
  93. documents_processed / search_time_in_ms * 1000
  94. ```