Elasticsearch的mapping一旦创建,只能增加字段,而不能修改已经mapping的字段
新建index并且写入数据
PUT /myindex/article/1 {
"post_date": "2018-05-10",
"title": "Java",
"content": "java is the best language",
"author_id": 119
}
PUT /myindex/article/2 {
"post_date": "2018-05-12",
"title": "html",
"content": "I like html",
"author_id": 120
}
PUT /myindex/article/3
{
"post_date": "2018-05-16",
"title": "es",
"content": "Es is distributed document store",
"author_id": 110
}
PUT /myindex/article/4
{
"name": "es practice",
"post_date": "2018-05-16",
"title": "es",
"content": "Es is distributed document store",
"author_id": 110
}
mapping 新增字段
PUT /myindex/_mapping/article
{
"properties": {
"new_field_name": {
"type": "text"
}
}
}