When I try to load a composable template from the logstash into the elasticsearch using the logstash output elasticsearch plugin, I get the error
Failed to install template. {:message=>"Got response code '400' contacting Elasticsearch at URL 'https://elasticsearch:9200/_template/snmp-infra-ps'", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError", :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb:80:in `perform_request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:332:in `perform_request_to_url'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:319:in `block in perform_request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:414:in `with_connection'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:318:in `perform_request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:326:in `block in Pool'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client.rb:352:in `template_put'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/http_client.rb:86:in `template_install'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/template_manager.rb:31:in `install'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/template_manager.rb:17:in `install_template'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/common.rb:218:in `install_template'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.3-java/lib/logstash/outputs/elasticsearch/common.rb:49:in `block in setup_after_successful_connection'"]}
My code in the logstash for elasticserach output is given below:
output {
elasticsearch {
hosts => ["${ES_PROTOCOL:https}://${ES_HOST_1:elasticsearch}:${ES_PORT_1:9200}", "${ES_PROTOCOL:https}://${ES_HOST_2:elasticsearch}:${ES_PORT_2:9200}", "${ES_PROTOCOL:https}://${ES_HOST_3:elasticsearch}:${ES_PORT_3:9200}"]
user => "${ES_USER:logstash}"
password => "${ES_PASSWORD:logstash}"
index => "telemetry-if-%{+YYYY.MM.dd}"
template => "/usr/share/logstash/index-templates/telemetry-if.json"
template_name => "telemetry-if"
manage_template => true
document_id => "%{[@timestamp]}%{[@metadata][fingerprint]}"
ilm_enabled => false
cacert => "${ES_CACERT:config/ca.crt}"
ssl => "${ES_ENABLE_SSL:true}"
ssl_certificate_verification => "${ES_CERTIFICATE_VERIFICATION:true}"
}
}
Can anyone guide me in this regard how to load composable template using logstash elasticsearch plugin. Thanks