I m trying to make custom index mapping template and use it with logstash
logstash config file output section
output{
elasticsearch {
hosts => "localhost:9200"
index => "employee_index"
document_id =>"%{empid}"
manage_template => false
template => "E:/abc/myfolder/data/testmapping.json"
template_name => "employee_index_1"
template_overwrite => true
}
following is testmapping.json file
{
"template": "employee_index_1",
"order": 1,
"index_patterns": [
"emp*" ],
"mappings": {
"_doc": {
"_source": {
"enabled": false
},
"properties": {
"empid": {
"type": "integer"
},
"empname": {
"type": "text"
},
"deptid": {
"type": "integer"
},
"revid": {
"type": "integer"
},
"revenue":{
"type":"nested",
"properties": {
"2013": {
"type": "long"
},
"2014": {
"type": "long"
}
}
}
}
}
}
}
now i m getting following output
{
"_index" : "employee_index",
"_type" : "doc",
"_id" : "4585",
"_score" : 1.0,
"_source" : {
"deptid" : 2222,
"revid" : 1256,
"empid" : 4585,
"rev2013" : "119.3",
"@version" : "1",
"empname" : "hetal k",
"@timestamp" : "2019-02-04T16:48:56.961Z",
"rev2014" : "830.3"
}
},
in mappings i mentioned nested field for revenue which is not coming in output
elasticsearch logs
[employee_index] creating index, cause [auto(bulk api)], templates , shards [5]/[1], mappings
[employee_index/OLr_2LyAQ4eMMuTLFQAwYA] create_mapping [doc]
GET _template/employee_index_1
is showing {}
so i guess the index template has not been created
Please help to sort out this issue.
Thanks