Custom template is getting ignored by latest LS2.0


(Vikas Gopal) #1

Hi Experts ,

I am trying to implement my custom mapping which is in "elasticsearch-2.0.0\config\templates" folder. Actually I copied my old template from LS1.5.4. It was working absolutely fine in the older version of LS.

Now as suggested by the latest LS documents (https://www.elastic.co/guide/en/logstash/current/_upgrading_logstash_and_elasticsearch_to_2_0.html) I am using following in the output plugin , but it is still ignoring my custom mapping.

output {   
if [type] == "LOG" {
elasticsearch { 
action => "index" 
template_overwrite => true
hosts => ["localhost:9200"]
index => "corr" 
workers => 2  
			}   
		}
}

Please suggest what I am doing wrong ?


(Aaron Mildenstein) #2

Elasticsearch 2.0 no longer allows you to use file-based templates. You must use the _template API to insert templates. (If you look at the 1.6 documentation, you'll see that the bottom-most block of text still allows for this config-file type template).

Fortunately, Logstash can do this for you. Just move that custom mapping file (must be complete JSON) to somewhere your Logstash user can read from, and add

template => "/path/to/mapping_template.json"

to your elasticsearch output block.


(system) #3