Elasticsearch创建mapping

(put)请求方式
http://192.168.1.200:9200/index_mapping

body 参数

{
"mappings":{
"properties":{
"realname":{
"type":"text",
"index":true
},
"username":{
"type":"keyword",
"index":false
}
}
}
}

mappings properties 为固定结构

realname username 相当于数据库中的 列 type 为数据类型 index是否支持索引
其中 text keyword 是数据类型 都属于 string类型 但是 keywrod不支持倒排索引 只支持精确查找

创建成功返回消息

{"acknowledged":true,"shards_acknowledged":true,"index":"index_mapping"}

如图显示索引信息 其中index=ture 默认不展示

猜你喜欢

转载自www.cnblogs.com/loujiang/p/12685034.html
今日推荐