# Component template

**URL:** https://discuss.elastic.co/t/component-template/361677
**Category:** Elasticsearch
**Created:** [June 18, 2024, 8:01pm UTC](https://discuss.elastic.co/t/component-template/361677 "2024-06-18T20:01:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kishore\_Pothireddy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kishore_pothireddy1/32/135381_2.png) [@Kishore\_Pothireddy1](https://discuss.elastic.co/u/Kishore_Pothireddy1)
#### Post date: [June 18, 2024, 8:01pm UTC](https://discuss.elastic.co/t/component-template/361677/1 "2024-06-18T20:01:09Z")

</div>

How to reference the custom analyzer present in settings component template in mappings component template?

I have created a component template for settings as shown below but creating a mappings component template that references customer analyzer defined in settings component template failing with error

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping [_doc]: analyzer [my_custom_analyzer] has not been configured in mappings"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [_doc]: analyzer [my_custom_analyzer] has not been configured in mappings",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "analyzer [my_custom_analyzer] has not been configured in mappings"
    }
  },
  "status": 400
}

```

Why it is not working? Any idea?  
btw i am using ES version 7.17.20

```auto
PUT _component_template/settings_template
{
  "template": {
    "settings": {
      "analysis": {
        "filter": {
          "my_custom_filter": {
            "type": "synonym",
            "synonyms": [
              "quick,fast",
              "jumps,leaps"
            ]
          }
        },
        "analyzer": {
          "my_custom_analyzer": {
            "type": "custom",
            "tokenizer": "standard",
            "filter": [
              "lowercase",
              "my_custom_filter"
            ]
          }
        }
      }
    }
  }
}

PUT /_component_template/mappings_template
{
  "template": {
    "mappings": {
      "properties": {
        "content": {
          "type": "text",
          "analyzer": "my_custom_analyzer"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 19, 2024, 1:22am UTC](https://discuss.elastic.co/t/component-template/361677/2 "2024-06-19T01:22:34Z")

</div>

Each component template is independent from the others. It means that you must set the analyzer within the same component template where you will use it.

---

<div class="post-metadata">

### Author: ![Kishore\_Pothireddy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kishore_pothireddy1/32/135381_2.png) [@Kishore\_Pothireddy1](https://discuss.elastic.co/u/Kishore_Pothireddy1)
#### Post date: [June 19, 2024, 1:41pm UTC](https://discuss.elastic.co/t/component-template/361677/3 "2024-06-19T13:41:10Z")

</div>

thanks much David. From the examples thought we can do so.

What happens when two component templates having same analyzer are part of a composable template? Which analyzer will be considered?
