背景: 前段时间,业务需要,为了快速让解析的Excel入库,所以把不是很确定的字段全部设置成了TEXT. 今天需要进行表结构优化,把字段长度控制在合适的范围,并尽量不使用TEXT类型. -- 计算长度select LENGTH(CAST(fileName AS CHAR)) from files; select MAX(LENGTH(CAST(fileName AS CHAR))) from files; select LENGTH(CAST(fileName AS CHAR)) as le f…
Having this field in my mapping "answer": { "type": "text", "fields": { "keyword": { "type": "keyword", } } }, I try to execute this aggregation "aggs": { "answer":…