在Elasticsearch中,“keyword”字段类型和使用“not_analyzed”作为分析器的字段之间有什么区别吗?如果有一个,什么时候使用哪个?
最佳答案
从breaking changes文档中可以看出,keyword
数据类型是ES 5中出现的新数据类型。其目的是将string
字段替换为"index": "not_analyzed"
。
因此在ES 1.x和2.x中,此声明
"field": {
"type": "string",
"index": "not_analyzed"
}
等效于ES 5中的此声明
"field": {
"type": "keyword"
}
同样,
text
数据类型将替换正常分析的字符串字段,因此在ES 1.x和2.x中,此声明"field": {
"type": "string"
}
将等同于ES 5中的此声明
"field": {
"type": "text"
}
关于elasticsearch - 类型关键字,没有分析,有什么区别吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37607022/