创建 type ("store":"yes")
PUT my_index
{
"mappings": {
"type_one": {
"properties": {
"text": {
"type": "string",
"analyzer": "standard"
}
}
},
"type_two": {
"properties": {
"text": {
"type": "string",
"analyzer": "standard"
}
}
}
}
}
PUT my_index/_mapping/type_one
{
"properties": {
"text": {
"type": "string",
"analyzer": "standard",
"search_analyzer": "whitespace"
}
}
}
PUT my_index/_mapping/type_one?update_all_types
{
"properties": {
"text": {
"type": "string",
"analyzer": "standard",
"search_analyzer": "whitespace"
}
}
}
//测试
{
"properties": {
"name": {
"analyzer": "standard",
"store": true,
"type": "string"
},
"text": {
"analyzer": "standard",
"store": true,
"type": "string"
},
"ziduan": {
"search_analyzer": "ik",
"analyzer": "standard",
"type": "string"
},
"title": {
"analyzer": "standard",
"store": true,
"type": "string"
},
"datt": {
"format": "yyyy/mm/dd",
"store": true,
"type": "date"
}
}
}
{
"name": "名称",
"text": "文本",
"ziduan": "字段",
"title": "标题",
"datt": "2016/03/04"
PUT my_index
{
"mappings": {
"type_one": {
"properties": {
"text": {
"type": "string",
"analyzer": "standard"
}
}
},
"type_two": {
"properties": {
"text": {
"type": "string",
"analyzer": "standard"
}
}
}
}
}
PUT my_index/_mapping/type_one
{
"properties": {
"text": {
"type": "string",
"analyzer": "standard",
"search_analyzer": "whitespace"
}
}
}
PUT my_index/_mapping/type_one?update_all_types
{
"properties": {
"text": {
"type": "string",
"analyzer": "standard",
"search_analyzer": "whitespace"
}
}
}
//测试
{
"properties": {
"name": {
"analyzer": "standard",
"store": true,
"type": "string"
},
"text": {
"analyzer": "standard",
"store": true,
"type": "string"
},
"ziduan": {
"search_analyzer": "ik",
"analyzer": "standard",
"type": "string"
},
"title": {
"analyzer": "standard",
"store": true,
"type": "string"
},
"datt": {
"format": "yyyy/mm/dd",
"store": true,
"type": "date"
}
}
}
{
"name": "名称",
"text": "文本",
"ziduan": "字段",
"title": "标题",
"datt": "2016/03/04"
}
https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-put-mapping.html