Custom template for not _analyzed field is not working


(bhavani) #1

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.


(bhavani) #2

Hi
Any update on this?


(David Pilato) #3

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?


(bhavani) #4

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 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!!!


(David Pilato) #5

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


(bhavani) #6

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.


(Xavier Facq) #7

Can you past the result of:

http://localhost:9200/_template?pretty

(bhavani) #8

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


(Steve Malenfant) #9

Was this ES 5.0? I can't get not_analyzed to work with 5.0.


(Steve Malenfant) #10

OK, found how to do it with ES 5.0.

https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html#_structured_search


(system) #11

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