# Custom template for not \_analyzed field is not working

**URL:** https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080
**Category:** Elasticsearch
**Created:** [November 15, 2016, 9:16am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080 "2016-11-15T09:16:14Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![bhavani1](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@bhavani1](https://discuss.elastic.co/u/bhavani1)
#### Post date: [November 15, 2016, 9:16am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/1 "2016-11-15T09:16:14Z")

</div>

Hi all,  
I have created a new template and posted into localhost using POSTMAN.The new INDEX is not replicating the changes. I couldn't find where I made mistake. Help me in this  
my new template is:

```
{
"template": "*",
 "order": 0,
 "settings": {
     "number_of_shards": 1 ,
 "index": {"refresh_interval": "5s" } 
  },
    "mappings": {
"_default_": {
	 "_all" : {"enabled" : true},
        "dynamic_templates" : [ {
 "string_fields" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
  "type" : "string", "index" : "not_analyzed", "omit_norms" : true 

  }
  }
}],

    "properties": {
    "COUNTRY" : {
        "type" : "string","index" : "not_analyzed"
      },
      "@timestamp" : {
        "type" : "date",
        "format" : "strict_date_optional_time||epoch_millis"
      },
      "@version" : {
        "type" : "string"
      },
        "DATE" : {
        "type" : "date",
        "format" : "strict_date_optional_time||epoch_millis"
      },  
  "ORDER" : {
        "type" : "string"
      },
      "ID" : {
        "type" : "string"
      }
  }
}
}
}

```

Template is acknowledged.  
In index the `number_of_shards` is also not replicating.

Thanks a lot.

---

<div class="post-metadata">

### Author: ![bhavani1](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@bhavani1](https://discuss.elastic.co/u/bhavani1)
#### Post date: [November 16, 2016, 4:33am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/2 "2016-11-16T04:33:30Z")

</div>

Hi  
Any update on this?

---

<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: [November 16, 2016, 7:23am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/3 "2016-11-16T07:23:08Z")

</div>

Be patient please.

Providing a full recreation script would be also helpful.

Here, just a guess, may be you think that updating a template will update existing indices?

---

<div class="post-metadata">

### Author: ![bhavani1](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@bhavani1](https://discuss.elastic.co/u/bhavani1)
#### Post date: [November 16, 2016, 9:10am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/4 "2016-11-16T09:10:38Z")

</div>

Thank u for ur reply !!

we are creating new index for new template.I had tried the new template by deleting all old indices.  
Here If COUNTRY is South Africa, in graph it is displaying South and Africa as separate fields.  
I need South Africa as same field.  
when I check the code using this URL\> [http://localhost:9200/temple/\_mappings?pretty](http://localhost:9200/temple/_mappings?pretty) the mappings are not shown correctly  
The mapping that is not replicating correctly is

[QUOTE]  
properties": {  
"COUNTRY" : {  
"type" : "string  
},  
[/QUOTE]

This is my problem ..I can provide more information if needed.

Thanks!!!

---

<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: [November 16, 2016, 9:23am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/5 "2016-11-16T09:23:23Z")

</div>

> [@bhavani1](#):
>
> I can provide more information if needed.

Yes. As I said "Provide a full recreation script". See for example:

> [@About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21):
>
> The heart of the free and open Elastic Stack Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease. warning PLEASE READ THIS SECTION IF IT'S YOUR FIRST POST Some useful links: [elasticsearch reference guide](http://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)[elasticsearch user guide](http://www.elastic.co/guide/en/elasticsearch/guide/current/index.html)[elasticsearch plugins](https://www.elastic.co/guide/en/elasticsearch/plugins/current/index.html)[elasticsearch cl…](https://www.elastic.co/guide/en/elasticsearch/client/index.html)

---

<div class="post-metadata">

### Author: ![bhavani1](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@bhavani1](https://discuss.elastic.co/u/bhavani1)
#### Post date: [November 16, 2016, 9:53am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/6 "2016-11-16T09:53:37Z")

</div>

my config file is

```
input {  
  file {
      path => "D:\workspace\conf\input.csv"
      start_position => "beginning"
	  ignore_older=>0
	  sincedb_path=>"nul"
  }
 }
 filter {  
 csv {
    columns => ["DATE","COUNTRY","ID","ORDER"]						
    separator => ","
    }

 date {
locale => "en"
 match => ["DATE", "dd-MMM-yy hh.mm.ss.SSSSSSSSS a"]
target => "DATE"
}
 }
 output {
elasticsearch {
 hosts => ["localhost:9200"]
 manage_template => false
 template_name => "logstashPattern"
 action => "index"
 index => "xyz"
 }
    stdout {codec => rubydebug}
  }

```

My Template is provided above.  
I am using Logstash 2.4 version,elasticsearch 2.3.5 and Kibana 4.5.1 version  
and input file is in CSV Format(I am using sample data not any files from client environment).we have two nodes in ES.

---

<div class="post-metadata">

### Author: ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)
#### Post date: [November 16, 2016, 10:13am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/7 "2016-11-16T10:13:25Z")

</div>

Can you past the result of:

```
http://localhost:9200/_template?pretty
```

---

<div class="post-metadata">

### Author: ![bhavani1](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@bhavani1](https://discuss.elastic.co/u/bhavani1)
#### Post date: [November 16, 2016, 11:25am UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/8 "2016-11-16T11:25:48Z")

</div>

Hi all,  
My template is working.I just changed my template name and tried.  
Thanks a lot for all your patience 😄

---

<div class="post-metadata">

### Author: ![carrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carrot/32/44335_2.png) [@carrot](https://discuss.elastic.co/u/carrot)
#### Post date: [November 16, 2016, 6:40pm UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/9 "2016-11-16T18:40:03Z")

</div>

Was this ES 5.0? I can't get not\_analyzed to work with 5.0.

---

<div class="post-metadata">

### Author: ![carrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carrot/32/44335_2.png) [@carrot](https://discuss.elastic.co/u/carrot)
#### Post date: [November 16, 2016, 6:59pm UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/10 "2016-11-16T18:59:02Z")

</div>

OK, found how to do it with ES 5.0.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html#\_structured\_search](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html#_structured_search)

---

<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: [December 14, 2016, 6:59pm UTC](https://discuss.elastic.co/t/custom-template-for-not--analyzed-field-is-not-working/66080/11 "2016-12-14T18:59:15Z")

</div>

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