TransportClient 新建index,mappings dynamic_templates。
public void createIndex(TransportClient client, String index){
CreateIndexRequest request = new CreateIndexRequest(index);
String setting =""
+"{"
+" \"number_of_shards\": 3,"
+" \"number_of_replicas\": 1,"
+" \"search_analyzer\": \"ik_max_word\""
+"}";
String mapping ="{"
+" \"dynamic_templates\": ["
+" {"
+" \"strings\": {"
+" \"match\": \"*\","
+" \"match_mapping_type\": \"string\","
+" \"mapping\": {"
+" \"type\": \"string\","
+" \"analyzer\": \"ik_max_word\","
+" \"fields\": {"
+" \"raw\": {"
+" \"type\": \"string\","
+" \"index\": \"not_analyzed\","
+" \"ignore_above\": 256"
+" }"
+" }"
+" }"
+" }"
+" }"
+" ]"
+" }";
request.settings(setting).mapping("_default_", mapping);
client.admin().indices().create(request);
}
POST http://192.168.1.12:9200/test
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 1,
"search_analyzer": "ik_max_word"
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"strings": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"analyzer": "ik_max_word",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed",
"ignore_above": 2560
}
}
}
}
}
]
}
}
}
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1,
"search_analyzer": "ik_max_word"
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"strings": {
"match": "*",
"unmatch": "id",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"analyzer": "ik_max_word",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed",
"ignore_above": 2560
}
}
}
}
},
{
"integers": {
"match": "id",
"mapping": {
"type": "integer"
}
}
}
]
}
}
}
TransportClient 新建index,mappings dynamic_templates。的更多相关文章
- (转)Maven 项目新建index.jsp报错问题
原文:http://blog.csdn.net/dream_ll/article/details/52198656 最近用eclipse新建了一个maven项目,结果刚新建完成index.jsp页面就 ...
- 索引模板和动态索引模板 (Index Template和Dynamic Template)
相关阅读 Index Templates https://www.elastic.co/guide/en/elasticsearch/reference/7.1/indices-templates.h ...
- nexus私服update repair index索引失败解决方案(转)
转载地址:http://blog.csdn.net/first_sight/article/details/51559086 问题描述: 搭建Maven的Nexus私服仓库,一般安装完Nexus后,默 ...
- 新建maven项目
1.新建maven project 注意:勾上create a new simple project 2.填写相关信息, Grounp id为大项目名字,Artifact id为小项目的名字.注意:P ...
- 新建一个self hosted Owin+ SignalR Project(1)
OWIN是Open Web Server Interface for .Net 的首字母缩写,他的定义如下: OWIN在.NET Web Server 与Web Application之间定义了一套标 ...
- nodejs 新建项目
第一步: 新建工程-->选择nodejs-->creat 注意: 如果出错就使用第二步!! 第二步:建立express 模板的nodejs 点击下图的命令窗口,依次输入下面命令 命令: & ...
- vscode新建html,没有模板
首先,在文件夹下右击--新建--index.html 输入! 按tab键 完成!
- 开发微信公众平台--新建新浪云sae部署server
创建新浪云计算应用 申请账号 我们使用SAE新浪云计算平台作为server资源.而且申请PHP环境+MySQL数据库作为程序执行环境. 申请地址:百度搜sae ,使用新浪微博账号能够直接登录SAE,登 ...
- windows cmd 新建和删除文件
1.新建文件夹 # 新建App文件夹 md app # 或者使用 mkdir mkdir app 2.新建文件 # 进入App文件夹cd app # 新建 index.js 文件 type nul&g ...
随机推荐
- Golang AES加密
package main import ( "crypto/aes" "crypto/cipher" "fmt" "os" ...
- Windows10下pip的配置文件设置
pip.ini的内容: [global] index-url = http://mirrors.aliyun.com/pypi/simple trusted-host = mirrors.aliyun ...
- PAT 乙级 1061. 判断题(15)
判断题的评判很简单,本题就要求你写个简单的程序帮助老师判题并统计学生们判断题的得分. 输入格式: 输入在第一行给出两个不超过100的正整数N和M,分别是学生人数和判断题数量.第二行给出M个不超过5的正 ...
- 启动apache 找不到 mbstring.dll
启动appserv时 提示 无法启动此程序 因为计算机中丢失php mbstring.dll 这种原因一般都是组件加载顺序引起的,在php.ini文件里确保 extension=php_mbstr ...
- Spring Boot 揭秘与实战 附录 - Spring Boot 公共配置
Spring Boot 公共配置,配置 application.properties/application.yml 文件中. 摘自:http://docs.spring.io/spring-boot ...
- nexus和maven的安装与配置
如果用普通用户安装就需要创建用户 属组例 groupadd configer //创建用户组 useradd -g configer configer //创建用户并指定用户组 passwd co ...
- ArcGIS中的数据连接问题——数据类型不统一
博主在研究空间数据分布的时候经常会用到 ArcGIS 进行空间数据可视化.但是有时候会由于数据类型不统一而无法将 csv 中的数据连接到底图上.比如在底图中的数据是字符串格式,而 csv 中是数字格式 ...
- Django框架之下载以及基本命令
Django的下载与基本命令 pip3 install Django #下载完成后保存在python解释器下的bin文件目录下 创建一个Django Project #命令行输入: django-ad ...
- 矩阵快速幂 51nod
基准时间限制:3 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注 给出一个N * N的矩阵,其中的元素均为正整数.求这个矩阵的M次方.由于M次方的计算结果太大,只需要输出 ...
- hdu4336 Card Collector 容斥原理
In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, fo ...