put_transform.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. --
  2. :api: put-transform
  3. :request: PutTransformRequest
  4. :response: AcknowledgedResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Put {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. ==== Put {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> How often to check for updates to the source indices
  35. <5> The PivotConfig
  36. <6> Optional free text description of the {transform}
  37. [id="{upid}-{api}-query-config"]
  38. ==== SourceConfig
  39. The indices and the query from which to collect data.
  40. If query is not set, a `match_all` query is used by default.
  41. ["source","java",subs="attributes,callouts,macros"]
  42. --------------------------------------------------
  43. include-tagged::{doc-tests-file}[{api}-source-config]
  44. --------------------------------------------------
  45. ==== DestConfig
  46. The index where to write the data and the optional pipeline
  47. through which the docs should be indexed
  48. ["source","java",subs="attributes,callouts,macros"]
  49. --------------------------------------------------
  50. include-tagged::{doc-tests-file}[{api}-dest-config]
  51. --------------------------------------------------
  52. ===== QueryConfig
  53. The query with which to select data from the source.
  54. ["source","java",subs="attributes,callouts,macros"]
  55. --------------------------------------------------
  56. include-tagged::{doc-tests-file}[{api}-query-config]
  57. --------------------------------------------------
  58. ==== PivotConfig
  59. Defines the pivot function `group by` fields and the aggregation to reduce the data.
  60. ["source","java",subs="attributes,callouts,macros"]
  61. --------------------------------------------------
  62. include-tagged::{doc-tests-file}[{api}-pivot-config]
  63. --------------------------------------------------
  64. <1> The `GroupConfig` to use in the pivot
  65. <2> The aggregations to use
  66. <3> The maximum paging size for the {transform} when pulling data
  67. from the source. The size dynamically adjusts as the {transform}
  68. is running to recover from and prevent OOM issues.
  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. include::../execution.asciidoc[]
  91. [id="{upid}-{api}-response"]
  92. ==== Response
  93. The returned +{response}+ acknowledges the successful creation of
  94. the new {transform} or an error if the configuration is invalid.