put_transform.asciidoc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. --
  2. :api: put-transform
  3. :request: PutTransformRequest
  4. :response: AcknowledgedResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Create {transform} API
  9. Creates a new {transform}.
  10. The API accepts a +{request}+ object as a request and returns a +{response}+.
  11. [id="{upid}-{api}-request"]
  12. ==== Create {transform} request
  13. A +{request}+ requires the following argument:
  14. ["source","java",subs="attributes,callouts,macros"]
  15. --------------------------------------------------
  16. include-tagged::{doc-tests-file}[{api}-request]
  17. --------------------------------------------------
  18. <1> The configuration of the {transform} to create
  19. <2> Whether or not to wait to run deferrable validations until `_start` is called.
  20. This option should be used with care as the created {transform} will run
  21. with the privileges of the user creating it. Meaning, if they do not have privileges,
  22. such an error will not be visible until `_start` is called.
  23. [id="{upid}-{api}-config"]
  24. ==== {transform-cap} configuration
  25. The `TransformConfig` object contains all the details about the
  26. {transform} configuration and contains the following arguments:
  27. ["source","java",subs="attributes,callouts,macros"]
  28. --------------------------------------------------
  29. include-tagged::{doc-tests-file}[{api}-config]
  30. --------------------------------------------------
  31. <1> The {transform} ID
  32. <2> The source indices and query from which to gather data
  33. <3> The destination index and optional pipeline
  34. <4> Optional, indicates how often to check for updates to the source indices
  35. <5> The PivotConfig
  36. <6> Optional free text description of the {transform}
  37. <7> Optional {transform} settings
  38. <8> Optional retention policy for the data in the destination index
  39. <9> Details required only when the {transform} runs continuously
  40. [id="{upid}-{api}-query-config"]
  41. ==== SourceConfig
  42. The indices and the query from which to collect data.
  43. If query is not set, a `match_all` query is used by default.
  44. ["source","java",subs="attributes,callouts,macros"]
  45. --------------------------------------------------
  46. include-tagged::{doc-tests-file}[{api}-source-config]
  47. --------------------------------------------------
  48. ==== DestConfig
  49. The index where to write the data and the optional pipeline
  50. through which the docs should be indexed
  51. ["source","java",subs="attributes,callouts,macros"]
  52. --------------------------------------------------
  53. include-tagged::{doc-tests-file}[{api}-dest-config]
  54. --------------------------------------------------
  55. ===== QueryConfig
  56. The query with which to select data from the source.
  57. ["source","java",subs="attributes,callouts,macros"]
  58. --------------------------------------------------
  59. include-tagged::{doc-tests-file}[{api}-query-config]
  60. --------------------------------------------------
  61. ==== PivotConfig
  62. Defines the pivot function `group by` fields and the aggregation to reduce the data.
  63. ["source","java",subs="attributes,callouts,macros"]
  64. --------------------------------------------------
  65. include-tagged::{doc-tests-file}[{api}-pivot-config]
  66. --------------------------------------------------
  67. <1> The `GroupConfig` to use in the pivot
  68. <2> The aggregations to use
  69. ===== GroupConfig
  70. The grouping terms. Defines the group by and destination fields
  71. which are produced by the pivot function. There are 3 types of
  72. groups
  73. * Terms
  74. * Histogram
  75. * Date Histogram
  76. ["source","java",subs="attributes,callouts,macros"]
  77. --------------------------------------------------
  78. include-tagged::{doc-tests-file}[{api}-group-config]
  79. --------------------------------------------------
  80. <1> The destination field
  81. <2> Group by values of the `user_id` field
  82. ===== AggregationConfig
  83. Defines the aggregations for the group fields.
  84. // TODO link to the supported aggregations
  85. ["source","java",subs="attributes,callouts,macros"]
  86. --------------------------------------------------
  87. include-tagged::{doc-tests-file}[{api}-agg-config]
  88. --------------------------------------------------
  89. <1> Aggregate the average star rating
  90. ===== RetentionPolicyConfig
  91. Defines a retention policy for the {transform}. Data that meets the defined
  92. criteria is deleted from the destination index.
  93. ["source","java",subs="attributes,callouts,macros"]
  94. --------------------------------------------------
  95. include-tagged::{doc-tests-file}[{api}-retention-policy-config]
  96. --------------------------------------------------
  97. <1> The date field that is used to calculate the age of the document.
  98. <2> Specifies the maximum age of a document in the destination index.
  99. ===== SettingsConfig
  100. Defines settings.
  101. ["source","java",subs="attributes,callouts,macros"]
  102. --------------------------------------------------
  103. include-tagged::{doc-tests-file}[{api}-settings-config]
  104. --------------------------------------------------
  105. <1> The maximum paging size for the {transform} when pulling data
  106. from the source. The size dynamically adjusts as the {transform}
  107. is running to recover from and prevent OOM issues.
  108. ===== SyncConfig
  109. Defines the properties {transforms} require to run continuously.
  110. ["source","java",subs="attributes,callouts,macros"]
  111. --------------------------------------------------
  112. include-tagged::{doc-tests-file}[{api}-sync-config]
  113. --------------------------------------------------
  114. <1> The date field that is used to identify new documents in the source.
  115. <2> The time delay between the current time and the latest input data time.
  116. include::../execution.asciidoc[]
  117. [id="{upid}-{api}-response"]
  118. ==== Response
  119. The returned +{response}+ acknowledges the successful creation of
  120. the new {transform} or an error if the configuration is invalid.