栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

ES之文档映射

ES之文档映射

ES之文档映射

一、索引文档映射关系创建
【PUT】请求:http://127.0.0.1:9200/user-info/_mapping,参数如下

{
    "properties" : {
        "name" : {
            "type" : "text",
            "index" : true
        },
        "sex" : {
            "type" : "keyword",
            "index" : true
        },
        "phoneNum" : {
            "type" : "keyword",
            "index" : false
        }
    }
}

user-info为提前创建好的索引名称(可以【PUT】请求:http://127.0.0.1:9200/user-info进行索引创建)
index表示该字段可以索引查询
type为字段类型,有多种,可参考 https://blog.csdn.net/ZYC88888/article/details/83059040

返回结果如下

{
    "acknowledged": true
}

二、查询索引文档映射关
【GET】请求:http://127.0.0.1:9200/user-info/_mapping
返回结果如下

{
    "user-info": {
        "mappings": {
            "properties": {
                "name": {
                    "type": "text"
                },
                "phoneNum": {
                    "type": "keyword",
                    "index": false
                },
                "sex": {
                    "type": "keyword"
                }
            }
        }
    }
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/688534.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号