Settings 和 Mappings_Settings_Ⅱ_实例 | 学习笔记

简介: 快速学习 Settings 和 Mappings_Settings_Ⅱ_实例

开发者学堂课程【ElasticSearch 入门精讲Settings 和 Mappings_Settings_Ⅱ_实例学习笔记,与课程紧密连接,让用户快速学习知识。

课程地址https://developer.aliyun.com/learning/course/631/detail/10028


Settings 和 Mappings_Settings_Ⅱ_实例


Mappings 详解

就是对索引库中索引的字段名称及其数据类型进行定义,类似于关系数据库中表建立时要定义字段名及其数据类型那样,(和 solr 中的 schme 类似)不过 es 的

一般不需要要指定 mapping 都可以,因为 es 会自动根据数据格式定义它的类型,如果你需要对某些字段添加特殊属性

(如︰定义使用其它分词器、是否分词、是否存储等),就必须手动添加 mapping

查询索引库的 mapping 信息

curl-XGEThttp://localhost:9200/bigdata/depl

mapping?prettymappings 修改字段相关属性,见备注

例如∶字段类型,使用哪种分词工具 mappings

注意∶

可以使用 indexAnalyzer 定义分词器,也可以使用 index_analyzer 定义分词器

image.png

查询 Bigdata 的一些语言数据信息,在查询下输入:

http://node01:9200/bigdata/ -mappings 提交请求,获得方式改为get

想查询某一个 product,则在查询下输入

http://node01:9200/bigdata/product/ ,获得方式改为 post.个别就为 mapping,所有就是 mappings,也可以用表格形式显示。

操作不存在的索引

curl -XPUT 'localhost :9200 /bigdata '

-d' ( "mappings " : { "emp " : { "properties" : { "name" : [ "type " : " string”,"

indexAnalyzer" :"ik"" , "searchAnalyzer":"ik”}}}}}

"mappings" :i{"emp" : {" properties" : i"name" :

i"type" :"string" ,"indexAnalyzer" :"ik","searchAnalyze

r :”ik"}}}}

点击验证

提交请求

image.png

点击动作,查看索引信息

image.png

操作已存在的索引

curl -xPoST http: / /localhost :9200/bigdata/dep/ _mapping-d' ( "properties" : ( "name " : [ "type" : "string " , "indexAnalyzer" :

""i", "searchAnalyzer":"ik"}}}'

点击OK下索引信息,字段 content 不支持,定位到 OK 下 News

image.png

验证一下,提交请求

image.png

相关文章
|
Unix Linux iOS开发
FastAPI(64)- Settings and Environment Variables 配置项和环境变量(下)
FastAPI(64)- Settings and Environment Variables 配置项和环境变量(下)
478 0
FastAPI(64)- Settings and Environment Variables 配置项和环境变量(下)
|
Java 数据库 Android开发
|
搜索推荐 开发者 索引
Settings 和 Mappings_Settings|学习笔记
快速学习 Settings 和 Mappings_Settings。
72 0
|
存储 自然语言处理 数据库
Settings 和 Mappings_Settings_Ⅰ_介绍 | 学习笔记
快速学习 Settings 和 Mappings_Settings_Ⅰ_介绍
75 0
Settings 和 Mappings_Settings_Ⅰ_介绍 | 学习笔记
|
开发者 索引
Settings 和 Mappings_Settings | 学习笔记
快速学习 Settings 和 Mappings_Settings
73 0
Settings 和 Mappings_Settings | 学习笔记
|
Java 开发者 索引
Settings 和 Mappings_概述|学习笔记
快速学习 Settings 和 Mappings_概述。
45 0
|
JSON BI 数据格式
Settings 和 Mappings_Mappings_Ⅱ_案例|学习笔记
快速学习 Settings 和 Mappings_Mappings_Ⅱ_案例。
63 0
|
存储 自然语言处理 数据库
Settings 和 Mappings_Mappings_Ⅰ_介绍|学习笔记
快速学习 Settings 和 Mappings_Mappings_Ⅰ_介绍。
63 0
|
SQL Java 开发者
Settings 和 Mappings_概述 | 学习笔记
快速学习 Settings 和 Mappings_概述
63 0
|
API 数据库 数据安全/隐私保护
FastAPI(64)- Settings and Environment Variables 配置项和环境变量(上)
FastAPI(64)- Settings and Environment Variables 配置项和环境变量(上)
455 0
FastAPI(64)- Settings and Environment Variables 配置项和环境变量(上)