- 创建索引
PUT /indexName
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
}
}
同时创建mapping
PUT /indexName
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"id":{
"type":"integer"
},
"title":{
"type":"keyword"
}
}
}
}
number_of_shards 分片数
number_of_replicas 副本数
- 修改索引
PUT /indexName/_settings
{
"number_of_replicas" : 1
}
可以改number_of_replicas,不能改number_of_shards
- 删除索引
DELETE /indexName
- 创建mapping
POST /indexName/typeName/_mapping
{
"properties": {
"name": {
"type": "text"
},
"description": {
"type": "text"
}
}
}
- 查询mapping
GET /indexName/typeName/_mapping
- 创建document
POST /indexName/typeName/id
{
"name":"python从入门到放弃",
"description":"人生苦短,我用Python"
}
- 查询document
GET /indexName/typeName/id
或
GET /indexName/typeName/_search?q=fieldName:fieldValue
- 删除document
DELETE /indexName/typeName/id
标签:indexName,replicas,number,mapping,命令,typeName,id,ES
From: https://www.cnblogs.com/foolish-xc/p/16938847.html