自定义数据类型-mapping
创建索引
curl -X PUT 192.168.1.27:9200/study-mappings修改索引的数据类型
curl -X POST 192.168.1.27:9200/study-mappings/_mapping \
-H "Content-Type: application/json" \
-d '{
"properties": {
"name": {
"type": "text",
"index": true
},
"gender": {
"type": "keyword",
"index": true
},
"province": {
"type": "keyword",
"index": true
},
"city": {
"type": "keyword",
"index": false
},
"address": {
"type": "keyword",
"index": true
},
"email": {
"type": "keyword",
"index": true
},
"ip_addr": {
"type": "ip"
},
"birthday": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
}
'查看索引的映射关系
创建文档数据
查看文档数据
搜索文档数据-基于gender查询-匹配keyword类型
搜索文档数据-基于name查询-匹配text类型
搜索文档数据-基于ip_addr查询-匹配ip类型
搜索文档数据-基于city查询-匹配keyword类型
output:
Last updated