I have created a template as shown below.
GET /_template/
{
"deal-expense-template": {
"order": 0,
"template": "[deal*]",
"settings": {
"index": {
"number_of_shards": "5"
}
},
"mappings": {
"kafka-connect": {
"properties": {
"NO_OF_DEALS": {
"type": "long"
},
"EXPENSE_CODE_DESCRIPTION": {
"type": "keyword"
},
"EXPENSE_CODE": {
"type": "keyword"
}
}
}
},
"aliases": {}
}
}
I am using Kafka Connect to write data to Elasticsearch which creates the following index.
GET /_all/_mapping
{
"deal-expense-new": {
"mappings": {
"kafka-connect": {
"properties": {
"EXPENSE_CODE": {
"type": "text"
},
"EXPENSE_CODE_DESCRIPTION": {
"type": "text"
},
"NO_OF_DEALS": {
"type": "long"
}
}
}
}
}
When Kafka writes it creates an index called deal-expense-new
and template would have been applied.
I can find this in logs:
[2018-06-13T15:23:37,901][INFO ][o.e.c.m.MetaDataCreateIndexService] [lrv141rq] [deal-expense-new] creating index, cause [api], templates [], shards [5]/[1], mappings [] [2018-06-13T15:23:38,214][INFO ][o.e.c.m.MetaDataMappingService] [lrv141rq] [deal-expense-new/lgsxUCd5THCDy9ykoMj5FA] create_mapping [kafka-connect]
Please let me know If I am doing anything wrong here.