Custom analyzers used across index templates

So I am trying to create a custom analyzer that I can use in multiple template definition so I can use the same custom analyzer one across multiple indices. I am using Elasticsearch 2.4 and I run into an error of type 'mapper_parsing_exception' with message 'analyzer [my_text_analyzer] not found for field [test_name]'

What I am trying to achieve looks something as follows in terms of code

PUT /_template/common_template

{
  "template": "*",
  "order": 0,
  "settings": {
    "analysis": {
      "analyzer": {
        "my_text_analyzer": {
          "type": "custom",
          "char_filter": ["html_strip"],
          "tokenizer": "standard",
          "filter": ["standard", "lowercase"]            
        }
      }
    }
  }
}

PUT /_template/test_template
{
  "template": "test*",
  "order": 1,
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 2
  },
  "mappings": {
    "structure": {
      "properties": {
        "test_name" : {
          "type": "string",
          "analyzer": "my_text_analyzer"
        }
      }
    }
  }
}

Is there a way to achieve this?

I need to create multiple families of indices (individual index template for each family) which need to use the same custom analyzer for string fields however they all use different kinds of type mappings making it very difficult to define it all in a single template.

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