查询集群状态:
GET _cluster/health?pretty
增加索引:
PUT lib
{
"settings":{
"index":{
"number_of_shards":3,
"number_of_replicas":0
}
}
}
PUT lib2
查询索引:
GET lib/_settings
GET _all/_settings
查询所有索引信息:
GET _cat/indices?v
添加文档:
(有ID)
PUT lib/user/1
{
"first_name":"Jane",
"last_name":"Smith",
"age":"32",
"about":"I like to collect rock albums",
"interests":["music"]
}
(无ID)
POST lib/user/
{
"first_name":"Douglas",
"last_name":"Fir",
"age":"23",
"about":"I like to build cabinets",
"interests":["forestry"]
}
查询
GET lib/user/1
GET lib/user/oHLq92oB9W0632qy5FJV
选择字段查询:
GET lib/user/1?_source=age,about
修改文档:
(新的覆盖)
PUT lib/user/1
{
"last_name":"Smith",
"age":"320",
"about":"I like to collect rock albums",
"interests":["music"]
}
POST lib/user/1/_update
{
"doc":{
"age":"30"
}
}
删除文档
DELETE lib/user/1
删除索引
DELETE lib2
閱讀更多 憧憬8星星 的文章