put_index_template.asciidoc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. --
  2. :api: put-index-template-v2
  3. :request: PutIndexTemplateV2Request
  4. :response: AcknowledgedResponse
  5. --
  6. [id="{upid}-{api}"]
  7. === Create or update composable index template API
  8. [id="{upid}-{api}-request"]
  9. ==== Request
  10. A +{request}+ specifies the `name` of a template and the index template configuration
  11. which consists of the `patterns` that control whether the template should be applied
  12. to the new index, and the optional mappings, settings and aliases configuration.
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests-file}[{api}-request]
  16. --------------------------------------------------
  17. <1> The name of the template
  18. <2> The index template configuration that specifies the index name patterns this template will match
  19. ==== Settings
  20. The settings of the template will be applied to the new index whose name matches the
  21. template's patterns.
  22. ["source","java",subs="attributes,callouts,macros"]
  23. --------------------------------------------------
  24. include-tagged::{doc-tests-file}[{api}-request-settings]
  25. --------------------------------------------------
  26. <1> Settings for this template
  27. <2> Configure the settings on the template building block
  28. <3> Create the IndexTemplateV2 object that configures the index template to apply the defined template to indices matching the patterns
  29. ==== Mappings
  30. The mapping of the template will be applied to the new index whose name matches the
  31. template's patterns.
  32. ["source","java",subs="attributes,callouts,macros"]
  33. --------------------------------------------------
  34. include-tagged::{doc-tests-file}[{api}-request-mappings-json]
  35. --------------------------------------------------
  36. <1> The mapping, provided as a JSON string
  37. <2> Configure the mapping on the template building block
  38. ==== Aliases
  39. The aliases of the template will define aliasing to the index whose name matches the
  40. template's patterns. A placeholder `{index}` can be used in an alias of a template.
  41. ["source","java",subs="attributes,callouts,macros"]
  42. --------------------------------------------------
  43. include-tagged::{doc-tests-file}[{api}-request-aliases]
  44. --------------------------------------------------
  45. <1> The alias to define
  46. <2> The alias to define with placeholder
  47. <3> Configure the aliases on the template building block
  48. ==== Component templates
  49. Component templates can be used as building blocks for specifying mappings, settings or aliases
  50. configurations, but they don't apply to indices themselves. To be applied to an index, the
  51. component templates must be specified in the `componentTemplates` list of the `IndexTemplateV2`
  52. index template definition object. The order in which they are specified in the list is the order
  53. in which the component templates are applied.
  54. ["source","java",subs="attributes,callouts,macros"]
  55. --------------------------------------------------
  56. include-tagged::{doc-tests-file}[{api}-request-component-template]
  57. --------------------------------------------------
  58. <1> The component template used by this index template
  59. ==== Priority
  60. In case multiple templates match an index, the priority of matching templates determines
  61. the index template which will be applied.
  62. Index templates with higher priority "win" over index templates with lower priority.
  63. ["source","java",subs="attributes,callouts,macros"]
  64. --------------------------------------------------
  65. include-tagged::{doc-tests-file}[{api}-request-priority]
  66. --------------------------------------------------
  67. <1> The priority of the template
  68. ==== Version
  69. A template can optionally specify a version number which can be used to simplify template
  70. management by external systems.
  71. ["source","java",subs="attributes,callouts,macros"]
  72. --------------------------------------------------
  73. include-tagged::{doc-tests-file}[{api}-request-version]
  74. --------------------------------------------------
  75. <1> The version number of the template
  76. ==== Optional arguments
  77. The following arguments can optionally be provided:
  78. ["source","java",subs="attributes,callouts,macros"]
  79. --------------------------------------------------
  80. include-tagged::{doc-tests-file}[{api}-request-create]
  81. --------------------------------------------------
  82. <1> To force to only create a new template; do not overwrite the existing template
  83. ["source","java",subs="attributes,callouts,macros"]
  84. --------------------------------------------------
  85. include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
  86. --------------------------------------------------
  87. <1> Timeout to connect to the master node as a `TimeValue`
  88. include::../execution.asciidoc[]
  89. [id="{upid}-{api}-response"]
  90. ==== Response
  91. The returned +{response}+ allows to retrieve information about the
  92. executed operation as follows:
  93. ["source","java",subs="attributes,callouts,macros"]
  94. --------------------------------------------------
  95. include-tagged::{doc-tests-file}[{api}-response]
  96. --------------------------------------------------
  97. <1> Indicates whether all of the nodes have acknowledged the request