<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;query&quot;: {
        &quot;more_like_this&quot;: {
            &quot;fields&quot;: [&quot;article_title&quot;, &quot;article_contents&quot;],
            &quot;like&quot; : 
                {
                    &quot;_index&quot; : &quot;alias_default&quot;,
                    &quot;_type&quot; : &quot;articles&quot;,
                    &quot;_id&quot; : &quot;1000000000001000000000000000001&quot;
                },

            &quot;min_doc_freq&quot;: 0,
            &quot;min_term_freq&quot; : 0,
            &quot;minimum_should_match&quot;:0,
            &quot;include&quot;:true
        }
    },
    &quot;from&quot;: 0,
    &quot;size&quot;: 6
}"><pre class="notranslate"><span class="pl-kos">{</span>
    <span class="pl-s">"query"</span>: <span class="pl-kos">{</span>
        <span class="pl-s">"more_like_this"</span>: <span class="pl-kos">{</span>
            <span class="pl-s">"fields"</span>: <span class="pl-kos">[</span><span class="pl-s">"article_title"</span><span class="pl-kos">,</span> <span class="pl-s">"article_contents"</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
            <span class="pl-s">"like"</span> : 
                <span class="pl-kos">{</span>
                    <span class="pl-s">"_index"</span> : <span class="pl-s">"alias_default"</span><span class="pl-kos">,</span>
                    <span class="pl-s">"_type"</span> : <span class="pl-s">"articles"</span><span class="pl-kos">,</span>
                    <span class="pl-s">"_id"</span> : <span class="pl-s">"1000000000001000000000000000001"</span>
                <span class="pl-kos">}</span><span class="pl-kos">,</span>

            <span class="pl-s">"min_doc_freq"</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span>
            <span class="pl-s">"min_term_freq"</span> : <span class="pl-c1">0</span><span class="pl-kos">,</span>
            <span class="pl-s">"minimum_should_match"</span>:<span class="pl-c1">0</span><span class="pl-kos">,</span>
            <span class="pl-s">"include"</span>:<span class="pl-c1">true</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"from"</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span>
    <span class="pl-s">"size"</span>: <span class="pl-c1">6</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This doesn't work</p>
<p dir="auto">where as if i provide textual like it works<br>
"like" : "Once upon a time",</p>
<p dir="auto">on ES 2.0</p>
<p dir="auto">mapping created as below</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="articles&quot; : {
        &quot;properties&quot; : {
          &quot;article_contents&quot; : {
            &quot;type&quot; : &quot;string&quot;,
            &quot;term_vector&quot; : &quot;yes&quot;
          },
          &quot;article_title&quot; : {
            &quot;type&quot; : &quot;string&quot;,
            &quot;term_vector&quot; : &quot;yes&quot;
          },"><pre class="notranslate"><span class="pl-s1">articles</span>" : <span class="pl-kos">{</span>
        <span class="pl-s">"properties"</span> : <span class="pl-kos">{</span>
          <span class="pl-s">"article_contents"</span> : <span class="pl-kos">{</span>
            <span class="pl-s">"type"</span> : <span class="pl-s">"string"</span><span class="pl-kos">,</span>
            <span class="pl-s">"term_vector"</span> : <span class="pl-s">"yes"</span>
          <span class="pl-kos">}</span><span class="pl-kos">,</span>
          <span class="pl-s">"article_title"</span> : <span class="pl-kos">{</span>
            <span class="pl-s">"type"</span> : <span class="pl-s">"string"</span><span class="pl-kos">,</span>
            <span class="pl-s">"term_vector"</span> : <span class="pl-s">"yes"</span>
          <span class="pl-kos">}</span><span class="pl-kos">,</span></pre></div>
<p dir="auto"><strong>Elasticsearch version</strong>: 2.4.0</p>
<p dir="auto"><strong>Plugins installed</strong>: [kopf]</p>
<p dir="auto"><strong>JVM version</strong>: 1.8.0_60</p>
<p dir="auto"><strong>OS version</strong>: OSX 10.11.6 locally, reproducible on CentOS 7.2.1511 as well</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:</p>
<p dir="auto">After upgrading to 2.4.0 our templates are no longer functioning from 2.3.3.</p>
<p dir="auto">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.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>Push a shared template with common analyzers/filters</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="POST /_template/analyzers
{
  &quot;template&quot;: &quot;*&quot;,
  &quot;order&quot;: 20,
  &quot;settings&quot;: {
    &quot;analysis&quot;: {
      &quot;analyzer&quot;: {
        &quot;untouched_analyzer&quot;: {
          &quot;type&quot;: &quot;custom&quot;,
          &quot;tokenizer&quot;: &quot;keyword&quot;,
          &quot;filter&quot;: [ &quot;max_length&quot;, &quot;lowercase&quot; ]
        },
        &quot;no_stopwords_analyzer&quot;: {
          &quot;type&quot;: &quot;custom&quot;,
          &quot;tokenizer&quot;: &quot;standard&quot;,
          &quot;filter&quot;: [ &quot;max_length&quot;, &quot;standard&quot;, &quot;lowercase&quot; ]
        }
      },
      &quot;tokenizer&quot;: {
        &quot;standard&quot;: {
          &quot;type&quot;: &quot;standard&quot;,
          &quot;version&quot;: &quot;4.4&quot;
        }
      },
      &quot;filter&quot;: {
        &quot;max_length&quot;: {
          &quot;type&quot;: &quot;length&quot;,
          &quot;max&quot;: &quot;32766&quot;
        }
      }
    }
  }
}"><pre class="notranslate"><code class="notranslate">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"
        }
      }
    }
  }
}
</code></pre></div>
<ol dir="auto">
<li>Push a language specific analyzer template, which is a <code class="notranslate">czech</code> analyzer referencing a filter from the <code class="notranslate">analyzers</code> template.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="POST /_template/analyzer-cs
{
  &quot;template&quot;: &quot;*-cs&quot;,
  &quot;order&quot;: 30,
  &quot;settings&quot;: {
    &quot;analysis&quot;: {
      &quot;analyzer&quot;: {
        &quot;default&quot;: {
          &quot;type&quot;: &quot;czech&quot;,
          &quot;filter&quot;: [ &quot;max_length&quot; ]
        }
      }
    }
  }
}"><pre class="notranslate"><code class="notranslate">POST /_template/analyzer-cs
{
  "template": "*-cs",
  "order": 30,
  "settings": {
    "analysis": {
      "analyzer": {
        "default": {
          "type": "czech",
          "filter": [ "max_length" ]
        }
      }
    }
  }
}
</code></pre></div>
<ol dir="auto">
<li>Push another language specific analyzer template which uses a custom analyzer, referencing some filters from the shared <code class="notranslate">analyzers</code> template.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="POST /_template/analyzer-en
{
  &quot;template&quot;: &quot;*-en&quot;,
  &quot;order&quot;: 30,
  &quot;settings&quot;: {
    &quot;analysis&quot;: {
      &quot;analyzer&quot;: {
        &quot;default&quot;: {
          &quot;type&quot;: &quot;custom&quot;,
          &quot;tokenizer&quot;: &quot;standard&quot;,
          &quot;filter&quot;: [ &quot;max_length&quot;, &quot;standard&quot;, &quot;lowercase&quot;, &quot;stop_en&quot; ]
        }
      },
      &quot;filter&quot;: {
        &quot;stop_en&quot;: {
          &quot;type&quot;: &quot;stop&quot;,
          &quot;stopwords&quot;: &quot;_english_&quot;,
          &quot;ignore_case&quot;: &quot;true&quot;
        }
      }
    }
  }
}"><pre class="notranslate"><code class="notranslate">POST /_template/analyzer-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"
        }
      }
    }
  }
}
</code></pre></div>
<p dir="auto">This action fails, resulting in:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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]];"><pre class="notranslate"><code class="notranslate">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]];
</code></pre></div>
<p dir="auto">However, as you see the first <code class="notranslate">analyzer-cs</code> was able to reference the <code class="notranslate">max_length</code> filter without issue.</p>
<p dir="auto">These templates worked fine in 2.3.3 and 2.3.4, haven't tried 2.3.5 but it sounds like there weren't any changes to that release. Reading over release notes for 2.4.0 don't seem to indicate anything that would prevent this functionality from being supported.</p>
<p dir="auto">We were seeing similar issues with referencing the shared analyzers in our mapping template file.</p>
<p dir="auto"><strong>Provide logs (if relevant)</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    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]];
        at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:360)
        at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService.validateAndAddTemplate(MetaDataIndexTemplateService.java:196)
        at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService.access$200(MetaDataIndexTemplateService.java:57)
        at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService$2.execute(MetaDataIndexTemplateService.java:157)
        at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45)
        at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:468)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.IllegalArgumentException: Custom Analyzer [default] failed to find filter under name [max_length]
        at org.elasticsearch.index.analysis.CustomAnalyzerProvider.build(CustomAnalyzerProvider.java:76)
        at org.elasticsearch.index.analysis.AnalysisService.&lt;init&gt;(AnalysisService.java:216)
        at org.elasticsearch.index.analysis.AnalysisService.&lt;init&gt;(AnalysisService.java:70)
        at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:50)
        at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
        at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
        at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
        at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
        at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
        at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
        at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
        at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
        at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
        at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
        at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
        at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
        at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
        at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
        at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
        at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
        at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:201)
        at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:879)
        at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)
        at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)
        at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)
        at org.elasticsearch.common.inject.InjectorImpl.createChildInjector(InjectorImpl.java:154)
        at org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:55)
        at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:358)
        ... 11 more"><pre class="notranslate"><code class="notranslate">    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]];
        at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:360)
        at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService.validateAndAddTemplate(MetaDataIndexTemplateService.java:196)
        at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService.access$200(MetaDataIndexTemplateService.java:57)
        at org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService$2.execute(MetaDataIndexTemplateService.java:157)
        at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45)
        at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:468)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.IllegalArgumentException: Custom Analyzer [default] failed to find filter under name [max_length]
        at org.elasticsearch.index.analysis.CustomAnalyzerProvider.build(CustomAnalyzerProvider.java:76)
        at org.elasticsearch.index.analysis.AnalysisService.&lt;init&gt;(AnalysisService.java:216)
        at org.elasticsearch.index.analysis.AnalysisService.&lt;init&gt;(AnalysisService.java:70)
        at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:50)
        at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
        at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
        at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
        at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
        at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
        at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
        at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
        at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
        at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
        at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
        at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
        at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
        at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
        at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
        at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
        at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
        at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
        at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:201)
        at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)
        at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:879)
        at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)
        at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)
        at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)
        at org.elasticsearch.common.inject.InjectorImpl.createChildInjector(InjectorImpl.java:154)
        at org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:55)
        at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:358)
        ... 11 more
</code></pre></div>