以下操作均在postman中操作
1. 创建索引
1.1请求地址
http://127.0.0.1:9200/test_index?pretty
1.2请求方式
PUT
1.3请求体
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 2
},
"mappings": {
"test_type": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "text"
},
"url": {
"type": "keyword"
},
"price": {
"type": "double"
}
}
}
}
}
test_index:索引名称
test_type:索引类型
properties:字段及其类型
number_of_shards:分片数量
number_of_replicas:副本数量
2. 修改索引(增加字段)
2.1 请求地址
http://127.0.0.1:9200/test_index/_mapping/test_type
2.2 请求方式
POST
2.3 请求体
{
"properties": {
"desc": {
"fielddata": true,
"analyzer": "keyword",
"type": "text"
}
}
}
在 test_type 下,增加 desc 属性
3.删除索引
3.1请求地址
http://127.0.0.1:9200/test_index
3.2 请求方式
DELETE
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。