Get component templates Generally available; Added in 7.8.0

GET /_component_template

Get information about component templates.

Required authorization

  • Cluster privileges: manage_index_templates

Query parameters

  • flat_settings boolean

    If true, returns settings in flat format.

  • settings_filter string | array[string]

    Filter out results, for example to filter out sensitive information. Supports wildcards or full settings keys

  • include_defaults boolean Generally available; Added in 8.11.0

    Return all default configurations for the component template

  • local boolean Deprecated

    If true, the request retrieves information from the local node only. If false, information is retrieved from the master node.

  • master_timeout string

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

    Values are -1 or 0.

    External documentation

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • component_templates array[object] Required
      Hide component_templates attributes Show component_templates attributes object
      • name string Required
      • component_template object Required
        Hide component_template attributes Show component_template attributes object
        • template object Required
        • version number
        • _meta object
        • deprecated boolean
        • created_date
        • modified_date
GET /_component_template
curl \
 --request GET 'http://api.example.com/_component_template'
Response examples (200)
A successful response for retrieving information about a component template.
{
  "component_templates" : [
    {
      "name" : "my-component-template",
      "component_template" : {
        "version" : 1,
        "_meta" : {
          "description" : "my custom component template"
        },
        "template" : {
          "settings" : {
            "index" : {
              "number_of_shards" : "1"
            }
          },
          "mappings" : {
            "properties" : {
              "@timestamp" : {
                "type" : "date"
              },
              "message" : {
                "type" : "text"
              }
            }
          }
        },
        "created_date" : "2024-01-01T12:00:00.000Z",
        "created_date_millis" : 1704110400000,
        "modified_date" : "2025-01-01T12:00:00.000Z",
        "modified_date_millis" : 1735732800000
      }
    }
  ]
}