@ct_json = application/json
@host = http://127.0.0.1:9200
@index_name = foo
@index_type = bar
### 删除数据
POST {{host}}/{{index_name}}/{{index_type}}/_delete_by_query HTTP/1.1
{
"query": {
"match_all": {}
}
}
### 查看数据(ALL)
POST {{host}}/{{index_name}}/{{index_type}}/_search HTTP/1.1
{
"query": {
"match_all": {}
},
"size": 100
}
### 查看数据(范围)
POST {{host}}/{{index_name}}/{{index_type}}/_search HTTP/1.1
{
"query": {
"range": {
"id": {
"gte": 130,
"lte": 147
}
}
},
"size": 100
}
### 查看数据(IN)
POST {{host}}/{{index_name}}/{{index_type}}/_search HTTP/1.1
{
"query": {
"terms": {
"containerId": ["CZYT0000016", "CZTY0000015"]
}
},
"size": 100
}
### 查看数据(多条件 + OR)
POST {{host}}/{{index_name}}/{{index_type}}/_search HTTP/1.1
{
"query": {
"bool" : {
"filter" : [
{
"bool" : {
"should" : [
{
"wildcard" : {
"userName" : {
"wildcard" : "*FOO*"
}
}
},
{
"wildcard" : {
"containerId" : {
"wildcard" : "*BAR*"
}
}
}
]
}
},
{
"match" : {
"nickName" : {
"query" : "周星驰"
}
}
}
]
}
},
"size": 100
}
### 聚合查询(Aggregation)
POST {{dev}}/{{ezt_index_name}}/{{ezt_index_type}}/_search?size=0 HTTP/1.1
{
"aggs" : {
"status_count": {
"terms": {
"field": "status"
}
}
}
}
### 更新数据
POST {{dev}}/{{ezt_index_name}}/{{ezt_index_type}}/_update_by_query HTTP/1.1
{
"query": {
"match": {
"id": 101
}
},
"script": {
"source": "ctx._source['status'] = 20",
"lang": "painless"
}
}