提问要多花一点心思哦

初始设置mapping映射时只有3个字段,如果后续索引时,字段多了或少了会有什么影响吗?

Elasticsearch | 作者 yonjar | 发布于2019年09月12日 | 阅读数:1725

es版本7.3.0
一开始新建索引
curl -H "Content-Type: application/json" -X PUT 'localhost:9200/accounts' -d '
{
"mappings": {
"properties": {
"user": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"title": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"desc": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}
}'

如果后续索引因需求变动,改变了数据源的表(传统数据库表增加或减少了字段),然后增量索引时,会不会有什么影响?
看了些文章说,会影响检索性能,但是具体是怎样子的也没有深入说道。
有些建议是最好和mapping的字段一致,如果后续需更改字段,需修改mapping.
es是有自动增加字段的功能的,但是不知道具体对后续会遇到哪些问题?
希望大神不吝赐教,小生感激不尽!
已邀请:

liuxg - Elastic

赞同来自:

一般来说后面增加多了字段会自定识别字段的类型,并自动适配,不会有什么影响。但是如果你想修改已经建立好的字段的类型,就需要重新reindex。关于如何做reindex,可以参考文章https://blog.csdn.net/UbuntuTo ... 31645

zqc0512 - andy zhou

赞同来自:

use aliases 
if not need delete today index  the new mapping will ok.

要回复问题请先登录注册