Elasticsearch 日期类型 Mapping 设置:使用 format 属性
在 Elasticsearch 中,您可以使用以下方式将日期类型设置为 mapping:
PUT my_index
{
"mappings": {
"properties": {
"my_date_field": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
在上面的示例中,我们定义了一个名为'my_date_field'的日期类型字段,并将其设置为格式为'yyyy-MM-dd HH:mm:ss'。您可以使用不同的日期格式,具体取决于您的需求。
原文地址: https://www.cveoy.top/t/topic/oWvu 著作权归作者所有。请勿转载和采集!