平时运维也许经常用到DSL
创建索引
PUT all_logs/?pretty
创建索引并指定字段类型
PUT all_logs2/_mapping
{
"properties": {
"uuid":{
"type": "keyword"
}
}
}
删除文档
POST all_logs/_delete_by_query
{
"query": {
"match_all": {
}
}
}
根据字段查找( 注意term需要keyword类型的字段)
GET /all_logs/_search
{
"query": {
"term": {
"_id": {
"value": "91ab98f8497e4bd296094e20457f7bde"
}
}
}
}
范围查询
{
"query": {
"range": {
"mytimes": {
"gte": "2021-05-07T14:48:06.529Z",
"lte": "2021-05-07T14:48:06.535Z"
}
}
}
}
清空指定索引的所有数据
POST /your_indexName/_delete_by_query
{
"query": {
"match_all": {}
}
}