curl -v 192.168.10.1:9200/_cat/health?v
# 在创建索引之前 对索引进行初始化操作,指定shards数量和replicas数量
curl -XPUT 'http://192.168.10.1:9200/library' -d {
"settings":{
"index":{
"number_of_shards":5,
"number_of_replicas":1,
}
}
}
GET 地址/索引名称/_settings
curl -X GET http://192.168.10.1:9200/test/_settings
GET 地址/索引名称,索引名称/_settings
curl -X GET http://192.168.10.1:9200/test,test2/_settings
curl -X GET http://192.168.10.1:9200/_all/_settings
curl -X GET 'http://192.168.10.1:9200/_cat/indices?v='
1.根据id查看文档信息
get 地址/索引名称/type名称/文档id
curl -X GET http://192.168.10.1:9200/test10/people/1
2.通过source获取指定字段
get /索引名称/type名称/文档id?_source=字段
curl -X GET http://192.168.10.1:9200/test10/people/1?_source=title
# 创建一个索引名称为test9的索引
curl -X PUT http://192.168.10.1:9200/test9/
{
"acknowledged": true,
"shards_acknowledged": true
}
PUT 地址/索引名称/type名称/文档id
curl -X PUT http://192.168.10.1:9200/test10/people/1 -d '{
"title": "test10"
}'
POST 地址/索引名称/type名称/
curl -X POST http://192.168.10.1:9200/test11/people/ -d
'{
"title": "test11"
}
PUT 地址/索引名称/type名称/文档id
curl -X PUT http://192.168.10.1:9200/test10/people/1 -d
'{
"title": "test10"
}'
POST 地址/索引名称/type名称/文档id/_update
curl -X POST http://192.168.10.1:9200/test10/people/1 -d
'{
"doc":{
"title": "testt12"
}
}'
curl -X DELETE http://192.168.10.1:9200/test10
delete 地址/索引名称/type名称/文档id
curl -X DELETE http://192.168.10.1:9200/test10/people/1