| text | 分词索引、全文检索、match 查询;排序聚合需额外开 fielddata(耗内存) |
|---|---|
| keyword | 整串匹配、term 查询、排序聚合;term 不支持前缀/通配 |
| 常见其他类型 | long/integer/double/date/boolean/ip/geo_point/object/nested/dense_vector |
multi-field 示例
multi-field 示例
{
"properties": {
"city": {
"type": "text",
"fields": {
"raw": { "type": "keyword", "ignore_above": 256 }
}
}
}
}对 text 字段直接做 terms 聚合会报 fielddata is disabled;应改用 city.raw 这类 keyword 子字段。