手動建立mapping以及增加屬性
只能創建index時手動建立mapping,或者新增field mapping,但是不能update field mapping
1、手動建立mapping
PUT /website
{
"mappings": {
"article": {
"properties": {
"author_id": {
"type": "long"
},
"title": {
"type": "text",
"analyzer": "english"
},
"content": {
"type": "text"
},
"post_date": {
"type": "date"
},
"publisher_id": {
"type": "text",
"index": "not_analyzed"
}
}
}
}
}
2、增加mapping屬性
PUT /website/_mapping/article
{
"properties" : {
"new_field" : {
"type" : "string",
"index": "not_analyzed"
}
}
}
3、測試mapping
GET /website/_analyze
{
"field": "content",
"text": "my-dogs"
}
手動建立mapping以及增加屬性