es应用服务初始化步骤
第一步:创建索引+settings+mapping
testes_v1 PUT
{
"settings": {
"index.mapping.total_fields.limit": 2000,
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"_doc": {"properties": { //省略字段的定义,很多字段 }}
}
}
testes_income_v1 PUT
{
"settings": {
"index.mapping.total_fields.limit": 2000,
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"_doc": {"properties": { //省略字段的定义,很多字段 }}
}
}
第二步:创建别名
/_aliases PUT
{
"actions": [
{ "add": {
"alias": "testes",
"index": "testes_v1"
}}
]
}
/_aliases PUT
{
"actions": [
{ "add": {
"alias": "testes_income",
"index": "testes_income_v1"
}}
]
}
第三步: 初始化
初始化接口,查询全部的数据来一条一条或者批量接口来初始化ES
http://IP:端口/indexNewAll
以上是在es客户端中执行,也可以将以上的初始化操作写成接口来调用,配置在xxlJob中。