# Custom analyzer defined in one template, but not found when referenced in another

**URL:** <https://discuss.elastic.co/t/custom-analyzer-defined-in-one-template-but-not-found-when-referenced-in-another/84763>\
**Category:** Elasticsearch\
**Created:** [May 5, 2017, 5:10pm UTC](https://discuss.elastic.co/t/custom-analyzer-defined-in-one-template-but-not-found-when-referenced-in-another/84763 "2017-05-05T17:10:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![redtopia](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@redtopia](https://discuss.elastic.co/u/redtopia)\
**Post date:** [May 5, 2017, 5:10pm UTC](https://discuss.elastic.co/t/custom-analyzer-defined-in-one-template-but-not-found-when-referenced-in-another/84763/1 "2017-05-05T17:10:52Z")

</div>

In my first attempt at using templates, I'm trying to define a bunch of stuff in a global template, including my custom analyzers, that will then be referenced in other templates. But I'm running into an error when I try to add a template that references an analyzer that's defined in my global template. I get the error:

> Error Type: [mapper\_parsing\_exception], Error Reason: [Failed to parse mapping [companies]: analyzer [tight] not found for field [name]]

Is it possible to reference a custom analyzer defined in a different template, or do I need to replicate the analyzer definitions in each template?

Here's how I define my global template, which I am able to add to the cluster:

```auto
{
	"template": "*",
	"order": 0,
	"version": 1,
	"settings": {
		"number_of_shards" : 1,
		"analysis": {
			"analyzer": {
				"tight": { ... }
			}
		}
	}
}

```

And then here's the next template that I try to define **(which generates the error)**

```auto
{
	"template": "companies",
	"order": 1,
	"version": 1,
	"mappings": {
		"companies": {
			"properties": {
				"name": {"type": "text", "analyzer": "tight"}
			}
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 6, 2017, 3:52am UTC](https://discuss.elastic.co/t/custom-analyzer-defined-in-one-template-but-not-found-when-referenced-in-another/84763/2 "2017-05-06T03:52:00Z")

</div>

> [@redtopia](#):
>
> Is it possible to reference a custom analyzer defined in a different template, or do I need to replicate the analyzer definitions in each template?

It's the latter.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 3, 2017, 4:03am UTC](https://discuss.elastic.co/t/custom-analyzer-defined-in-one-template-but-not-found-when-referenced-in-another/84763/3 "2017-06-03T04:03:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
