查询节点
GET /_cat/nodes?v
查询所有索引
GET /_cat/indices?v
创建索引
PUT /test_index?pretty
test_index是索引名
查询索引结构
GET /test_index
查询指定索引指定表的记录
GET /test_index/table1/_search
{
"query": {
"match_all":{}
}
}
用简单的查询可以这样
GET /test_index/_search?q=*
GET /test_index/_search?q=name:jane
创建mapping(定义表结构)
PUT /test_index/_mapping/table1
{
"properties": {
"sex":{
"type":"integer"
},
"is_enable": {
"type":"boolean"
}
}
}
插入/更新记录
POST /test_index/table1/1
{
"id":1,
"name":"张四",
"descriptions":"就是那个传说中的张四",
"age":80,
"nickname":"张小四",
"books":{
"name":"张小四自传",
"price":55555
}
}
其中:
test_index:索引名
table1:表名
1:id
指定id删除记录
DELETE /test_index/table1/1
批量删除
POST /test_index/table1/_bulk
{"delete":{"_id":"1"}}
清空table1表的记录
POST /test_index/table1/_delete_by_query?conflicts=proceed
{
"query": {
"match_all": {}
}
}
更新数据,只对指定的字段更新
POST /test_index/table1/2/_update
{
"doc": {
"name": "Jane Doe"
}
}