mapping 详解4(mapping setting)
mapping type
映射设置一般发生在:
1. 增加新的 index 的时候,添加 mapping type,对 fields 的映射进行设置
PUT twitter
{
"mappings": {
"tweet": {
"properties": {
"message": {
"type": "string"
}
}
}
}
}
2. 为 index 增加新的 mapping type,对 fields 的映射进行设置
PUT twitter/_mapping/user
{
"properties": {
"name": {
"type": "string"
}
}
}
3. 为已有 mapping type 增加新的 fields 映射设置
PUT twitter/_mapping/tweet
{
"properties": {
"user_name": {
"type": "string"
}
}
}
设置方式
1. 在 PUT 请求体中给出完整的 mapping 设置
PUT twitter
{
"mappings": { //mappings 对象,说明进行 mapping 设置
"tweet": { //指定 mapping type
"properties": { //指定 mapping type 的 properties 设置
"message": { //对字段 message 的映射进行设置
"type": "string" //mapping 参数配置
}
}
}
}
}
增加 index 的时候,除了可以设置 mapping type,还可以对 index 进行设置,比如配置自定义 analyzer、索引分片个数设置等
PUT /my_index
{
"settings": {
"analysis": {
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
},
"mappings": {
"my_type": {
"properties": {
"text": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}
}
2. 在 PUT 请求 URI 中指定 type,并在请求体中给出 type 的各项设置
PUT twitter/_mapping/user
{
"properties": { //指定 mapping type 的 properties 设置
"name": { //对字段 message 的映射进行设置
"type": "string" //mapping 参数配置
}
}
}
3. 一个完整的 mapping type 设置包括:Meta-fields 和 Fields 或者 properties 设置
PUT my_index
{
"mappings": {
"type_1": {
"properties": {...} //properties 设置
},
"type_2": {
"_all": { //meta-fields 设置
"enabled": false
},
"properties": {...}
}
}
}
mapping 详解4(mapping setting)的更多相关文章
- mapping 详解2(field datatypes)
基本类型 1. 字符串 字符串类型被分为两种情况:full-text 和 keywords. full-text 表示字段内容会被分析,而 keywords 表示字段值只能作为一个精确值查询. 参数: ...
- mapping 详解5(dynamic mapping)
概述 在使用 ES 的时,我们不需要事先定义好映射设置就可以直接向索引中导入文档.ES 可以自动实现每个字段的类型检测,并进行 mapping 设置,这个过程就叫动态映射(dynamic mappin ...
- mapping 详解3(Meta-Fields)
文档标识相关元数据字段 _index 当执行多索引查询时,可能需要添加特定的一些与文档有关联的索引的子句. _index 字段可以用在 term.terms 查询,聚合(aggregations)操作 ...
- mapping 详解1(mapping type)
映射(mapping) 映射是定义一个文档以及其所包含的字段如何被存储和索引的方法. 例如,用映射来定义以下内容: 哪些 string 类型的 field 应当被当成当成 full-text 字段 哪 ...
- Elasticsearch5.X Mapping详解
0.引言 在关系型数据库如Mysql中,设计库表需要注意的是: 1)需要几个表: 2)每个表有哪些字段: 3)表的主键及外键的设定——便于有效关联. 表的设计遵守范式约束,考虑表的可扩展性,避免开发后 ...
- elasticsearch最全详细使用教程:入门、索引管理、映射详解、索引别名、分词器、文档管理、路由、搜索详解
一.快速入门1. 查看集群的健康状况http://localhost:9200/_cat http://localhost:9200/_cat/health?v 说明:v是用来要求在结果中返回表头 状 ...
- elasticsearch系列二:索引详解(快速入门、索引管理、映射详解、索引别名)
一.快速入门 1. 查看集群的健康状况 http://localhost:9200/_cat http://localhost:9200/_cat/health?v 说明:v是用来要求在结果中返回表头 ...
- maven学习(一)setting.xml配置文件详解
maven环境搭建: 1.官网下载zip包,解压至任意目录(如:E:\wly\apache-maven-3.2.5) 2.环境变量MAVEN_HOME(E:\wly\apache-maven-3.2. ...
- Maven配置文件setting.xml详解
注:本文来源于:大话JAVA的那些事 <Maven配置文件setting.xml详解> <?xml version="1.0" encoding="UT ...
随机推荐
- POJ 3321 Apple Tree(dfs序树状数组)
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=10486 题意:一颗有n个分支的苹果树,根为1,每个分支只有一个苹果,给出n- ...
- Android Socket 相关
http://www.imooc.com/learn/223 http://www.epubit.com.cn/book/onlinechapter/12093
- [转载]maven基础入门
用 Maven 做项目构建 本文转载自:https://www.ibm.com/developerworks/cn/java/j-lo-maven/ 本文将介绍基于 Apache Maven 3 的项 ...
- HW6.11
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- Apache下安装配置mod_pagespeed模块,轻松完成网站提速
mod_pagespeed是一个开源的Apache module,它由谷歌开发,通过优化你的网页来减少响应延迟和带宽占用.作用参考ngx_pagespeed功能:http://blog.linuxey ...
- keil中的存储模式
存储模式 存储模式决定了默认的存储器类型此存储器类型将应用于函数参数局部变量和定义时未包含存储器类型的变量你可以在命令行用SMALL COMPACT和LARGE参数定义存储模式,定义变量时使用存储器类 ...
- 我被eclipse的tomcat坑的经历
奇怪的乱码问题: 1.jsp页面utf-8 2.java代码utf-8 3.数据库编码utf-8 4.tomcat server.xml配置URIEncoding="UTF-8" ...
- pom.xml报错
错误太多打开文件后就不会显示,点开前边的选项卡就会提示错误信息,一般是jar包没加载全.
- python3使用PyMysql连接mysql数据库
python语言的3 x完全不向前兼容,导致我们在python2 x中可以正常使用的库,到了python3就用不了了 比如说mysqldb目前MySQLdb并不支持python3 python语言的3 ...
- Flume + HDFS + Hive日志收集系统
最近一段时间,负责公司的产品日志埋点与收集工作,搭建了基于Flume+HDFS+Hive日志搜集系统. 一.日志搜集系统架构: 简单画了一下日志搜集系统的架构图,可以看出,flume承担了agent与 ...