這聽起來像你們不關心日期類型或任何類型。 我認爲最好的解決辦法是定義一個動態模板將定義所有類型爲字符串:
{
"_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。
上次我檢查了它,只是省略了文檔中的字段,如果你不想丟失數據,這是不可接受的。 – Shahar
這是駭人的,因爲該設置是全球性的,適用於所有指標。 –