PUT /abc
{
"settings": {
"number_of_shards": "10",
"number_of_replicas": "1"
},
"mappings": {
"doc": {
"dynamic": "strict",
"properties": {
"address": {
"type": "text",
"analyzer": "ik_max_word"
},
"board_train_code": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"borad_train_code": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
}
{
"settings": {
"number_of_shards": "10",
"number_of_replicas": "1"
},
"mappings": {
"doc": {
"dynamic": "strict",
"properties": {
"address": {
"type": "text",
"analyzer": "ik_max_word"
},
"board_train_code": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"borad_train_code": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
}
3 个回复
medcl - 今晚打老虎。
赞同来自:
board_train_code
这样的两个字段名,我也是醉了,稍不留神,就选错了。
Java 创建 mapping 官网不是有文档么:
https://www.elastic.co/guide/e ... .html
lzc
赞同来自:
我的意思是:比如字段为name,那么如何创建name和name.keyword两个字段
我按下面这样做不行啊
elasticsearch版本6.1.2
PUT /abc
{
"settings": {
"number_of_shards": "10",
"number_of_replicas": "1"
},
"mappings": {
"doc": {
"dynamic": "true",
"properties": {
"action": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
es_zoom
赞同来自: