I want to enable date_detection but, at the same time, I want to store all fields as not_analyzed by default.
So I'm using these mappings with date_detection: true and a dynamic_template. Dates are not detected, and they are indexed as strings. If I remove the index: "not_analyzed" part of the dynamic template, then dates are detected but all my fields are analyzed. Is there any way to enable both behaviours (date_detection + not_analyzed)?
{
"template":"*",
"mappings":{
"_default_":{
"date_detection":true,
"_all":{
"enabled":false
},
"dynamic_templates": [
{
"template_do_not_analyze": {
"mapping": {
"index": "not_analyzed",
"type": "{dynamic_type}"
},
"match": "*"
}
}
],
"properties":{
"msg":{
"type":"string",
"index":"analyzed"
}
}
...
I'm using ElasticSearch 2.2 and I don't know the names of the fields that contain dates in advance.
Thank you !