查询ES中所有数据
GET _search
{
"query": {
"match_all": {}
}
}
查询集群状况
GET _cat/health?v
查询节点信息
GET _cat/nodes?v
查询索引
GET _cat/indices
创建index 有两种方式 PUT POST
PUT 创建自定义属性 POST会自动创建规定的属性
PUT /test_index
{
"mappings": {
"_doc" : {
"properties" : {
"username" : {"type":"text"},
"password" : {"type":"long"}
}
}
}
}
查询映射关系
GET /test_index/_mapping/_doc/
插入数据
PUT /test_index/_doc/1
{
"username" : "logincat",
"password" : "123"
}
查询id=1的数据
GET /test_index/_doc/1
只显示数据
GET /test_index/_doc/1/_source
修改数据只能使用POST 而且需要使用_update 应该时之前的版本 6.5就可以用PUT
POST /test_index/_doc/1/_update
{
"doc": {
"password" : "12345"
}
}
网友评论