# Custom analyzer unable to find filter/tokenizers from other templates

**URL:** <https://discuss.elastic.co/t/custom-analyzer-unable-to-find-filter-tokenizers-from-other-templates/60384>\
**Category:** Elasticsearch\
**Created:** [September 13, 2016, 2:01pm UTC](https://discuss.elastic.co/t/custom-analyzer-unable-to-find-filter-tokenizers-from-other-templates/60384 "2016-09-13T14:01:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeb7986](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@mikeb7986](https://discuss.elastic.co/u/mikeb7986)\
**Post date:** [September 13, 2016, 2:01pm UTC](https://discuss.elastic.co/t/custom-analyzer-unable-to-find-filter-tokenizers-from-other-templates/60384/1 "2016-09-13T14:01:23Z")

</div>

After upgrading to 2.4.0 our templates are no longer functioning from 2.3.3.

We have our template split up into several templates so we can specify default analyzers per language, and we share analyzers/filters/tokenizers between the templates.

Here is a simplified example of the problem:

```
POST /_template/analyzers
{
  "template": "*",
  "order": 20,
  "settings": {
    "analysis": {
      "analyzer": {
        "untouched_analyzer": {
          "type": "custom",
          "tokenizer": "keyword",
          "filter": ["max_length", "lowercase"]
        },
        "no_stopwords_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["max_length", "standard", "lowercase"]
        }
      },
      "tokenizer": {
        "standard": {
          "type": "standard",
          "version": "4.4"
        }
      },
      "filter": {
        "max_length": {
          "type": "length",
          "max": "32766"
        }
      }
    }
  }
}

POST /_template/analyzers-en
{
  "template": "*-en",
  "order": 30,
  "settings": {
    "analysis": {
      "analyzer": {
        "default": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["max_length", "standard", "lowercase", "stop_en"]
        }
      },
      "filter": {
        "stop_en": {
          "type": "stop",
          "stopwords": "_english_",
          "ignore_case": "true"
        }
      }
    }
  }
}

```

This results in the following error:

```
2016-09-13 09:52:00,174][DEBUG][action.admin.indices.template.put] [Zartra] failed to put template [analyzers-en]
[kOccXLKbR5CwAsXCt0v_3w] IndexCreationException[failed to create index]; nested: IllegalArgumentException[Custom Analyzer [default] failed to find filter under name [max_length]];

```

I can provide the full stacktrace if necessary.

Interestingly, if it's not a custom analyzer, other analyzer seem to have no issues:

```
POST /_template/analyzers-cs
{
  "template": "*-cs",
  "order": 30,
  "settings": {
    "analysis": {
      "analyzer": {
        "default": {
          "type": "czech",
          "filter": ["max_length"]
        }
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [September 16, 2016, 2:36am UTC](https://discuss.elastic.co/t/custom-analyzer-unable-to-find-filter-tokenizers-from-other-templates/60384/2 "2016-09-16T02:36:23Z")

</div>

Hi @mikeb7986  
I replied [https://github.com/elastic/elasticsearch/issues/20479#issuecomment-247063641](https://github.com/elastic/elasticsearch/issues/20479#issuecomment-247063641) .  
After 2.4, we validate template as a complete mapping and settings.  
If you add `max_length` filter settings to each template, you get OK.

In your last example about `default` analyzer, elasticsearch ignores `filter` settings because `czech` ANALYZER does not support filter settings.

---

<div class="post-metadata">

**Author:** ![mikeb7986](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@mikeb7986](https://discuss.elastic.co/u/mikeb7986)\
**Post date:** [September 16, 2016, 4:49am UTC](https://discuss.elastic.co/t/custom-analyzer-unable-to-find-filter-tokenizers-from-other-templates/60384/3 "2016-09-16T04:49:21Z")

</div>

That makes sense, so it's not necessarily `custom` analyzers, we can continue the discussion on github.

---

<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:** [July 5, 2017, 10:19pm UTC](https://discuss.elastic.co/t/custom-analyzer-unable-to-find-filter-tokenizers-from-other-templates/60384/4 "2017-07-05T22:19:51Z")

</div>


