概述
1.创建模板
PUT _template/template_purchaser_info
{
"order": 1,
"template": "purchaser_invoice_*",
"settings": {
"index": {
"number_of_shards": "6",
"number_of_replicas": "0",
"mapper": {
"dynamic": "false"
}
}
},
"mappings": {
"invoice": {
"properties": {
"id": {
"type": "text"
},
"invoiceType": {
"type": "keyword"
},
"invoiceNo": {
"type": "keyword"
},
"invoiceCode": {
"type": "keyword"
},
"status": {
"type": "keyword"
},
"createTime": {
"type": "date",
"format": "date_time"
},
"updateTime": {
"type": "date",
"format": "date_time"
},
"createUserId": {
"type": "keyword"
},
"createUserName": {
"type": "keyword"
}
}
}
},
"aliases": {
"purchaser_invoice_info": {}
}
}
2.基于模板建索引
匹配到映射路径即可
PUT purchaser_invoice_v1
3 给索引添加字段
POST purchaser_invoice_info/_mapping/invoice
{
"properties": {
"customerNo": {
"type": "keyword"
},
"auditStatus": {
"type": "keyword"
}
}
}
4.查看索引mapping
GET purchaser_invoice_info/_mapping
5.dsl查询
GET tax_goods/_search
{
"query": {
"match": {
"taxcodeName": "垃圾清运费"
}
}
}
6.条件删除doc
POST tax_goods/_delete_by_query
{
"query": {
"match": {
"goodsName": "垃圾清运费"
}
7.删除索引
DELETE purchaser_invoice_v1
8.获取所有模板
最后
以上就是忧虑大船为你收集整理的es 常见操作的全部内容,希望文章能够帮你解决es 常见操作所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复