听起来你们不关心日期类型或任何类型。
我认为最好的解决方案是定义一个动态模板,将所有类型定义为字符串:
{
"_default_" : {
"dynamic_templates" : [
{
"long_to_string" : {
"match" : "*",
"match_mapping_type": "long",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
},
{
"double_to_string" : {
"match" : "*",
"match_mapping_type": "double",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
},
{
"float_to_string" : {
"match" : "*",
"match_mapping_type": "float",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
},
{
"integer_to_string" : {
"match" : "*",
"match_mapping_type": "integer",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
},
{
"date_to_string" : {
"match" : "*",
"match_mapping_type": "date",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
},
{
"boolean_to_string" : {
"match" : "*",
"match_mapping_type": "boolean",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
}
]
}
}
来自here。