I have a template as below:
curl -XPUT localhost:9200/_template/template_flow_detail -d '
{
"template" : "flow_detail_*",
"mappings" : {
"traffic" : {
"properties" : {
"@timestamp": { "index": "not_analyzed", "type": "date","format": "epoch_second"},
"router_ip" : { "type" : "integer", "index" : "not_analyzed"},
"interface" : { "type" : "integer", "index" : "not_analyzed"},
"src_ip" : { "type" : "ip", "index" : "not_analyzed"},
"dst_p" : { "type" : "ip", "index" : "not_analyzed"},
"src_port" : { "type" : "integer", "index" : "not_analyzed"},
"dst_port" : { "type" : "integer", "index" : "not_analyzed"},
"protocol" : { "type" : "string", "index" : "not_analyzed" },
"bits" : { "type" : "long", "index" : "not_analyzed" },
"pkts" : { "type" : "long", "index" : "not_analyzed" }
}
}
},
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}'
There is only one type in the template and only one field called @timestamp. When I bulk index data into this index it show error like below:
[2016-04-06 10:06:11,090][DEBUG][action.bulk ] [ES01] [flow_detail_1459382400][0] failed to execute bulk item (index) index {[flow_detail_1459382400][netflow][172987603026241459440300], source[{"flow_direction": 1, "src_port": 12772, "@timestamp": 1459440300, "src_ip": 712529336, "pkts": 5, "router_ip": 172987603, "dst_port": 18365, "dst_ip": 712529524, "interface": 3, "protocol": "sctp", "bits": 12392}]}
java.lang.IllegalArgumentException: Mapper for [@timestamp] conflicts with existing mapping in other types:
[mapper [@timestamp] is used by multiple types. Set update_all_types to true to update [format] across all types.]
at org.elasticsearch.index.mapper.FieldTypeLookup.checkCompatibility(FieldTypeLookup.java:170)
at org.elasticsearch.index.mapper.MapperService.checkMappersCompatibility(MapperService.java:402)
at org.elasticsearch.index.mapper.MapperService.checkMappersCompatibility(MapperService.java:411)
at org.elasticsearch.index.mapper.DocumentMapper.merge(DocumentMapper.java:390)
at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:261)
at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:230)
at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:458)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:762)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Can Anyone tell me why this error is happenning since I only have one type?
Also where to set the update_all_type ?