I have upgraded to Elasticsearch 6.2 from 5.0. I am facing challenges in dynamic template.
Template I have uploaded to ES is:
curl -XPOST localhost:9200/_template/mytemplate -H 'Content-Type: application/json' -d'
{
"index_patterns": [
"my*"
],
"settings": {
"number_of_shards": 2
},
"mappings": {
"mytype": {
"dynamic_templates": [
{
"string_fields": {
"match_mapping_type": "string",
"match": "*",
"mapping": {
"index": "not_analyzed",
"ignore_above": 256,
"type": "string"
}
}
}
],
"properties":{
"createdAt":{
"type":"date",
"format": "epoch_millis"
}
}
}
}
}'
The template is successfully loaded into elasticsearch. But when I am trying to load data into elasticSearch, its throwing following error:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to find type parsed [string] for [fname]"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to find type parsed [string] for [fname]"
},
"status": 400
}
Data i am trying to load:
{
"fname":"aditya",
"lname":"prateek",
"createdAt":1527602481459
}
Also, I have tried giving
"mapping": {
"index": "not_analyzed",
"ignore_above": 256,
"type": "keyword"
}
But, I am getting another error: "Failed to parse value [not_analyzed] as only [true] or [false] are allowed."
Am I doing anything wrong here?