查询指定id信息
GET /index_name/_doc/1074266245
查询指定信息并降序
GET /index_name/_search
{
"query": {
"term": {
"deviceId": {
"value": "1074266245"
}
}
},
"sort": [
{
"timestamp": {
"order": "desc"
}
}
]
}
//多条件查询
GET /index_name/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"payload.locator_dev_id": {
"value": 100902
}
}
},
{
"term": {
"payload.dev_id": {
"value": 100301
}
}
}
]
}
},
"sort": [
{
"timestamp": {
"order": "desc"
}
}
]
}
//自定字段去重查询
GET /index_name/_search
{
"query": {
"term": {
"bodyObj.payLoad.dev_id": {
"value": "100101"
}
}
},
"collapse": {
"field": "bodyObj.payLoad.key"
},
"from": 0,
"size": 10,
"track_total_hits": true,
"aggs": {
"courseAgg": {
"cardinality": {
"field": "bodyObj.payLoad.key"
}
}
}
}
//修改指定字段值
POST /index_name/_update/101202
{
"doc": {
"category":"2"
}
}
#指定字段必须存在或不存在
GET /index_name/_search
{
"query": {
"bool": {
"must": [
{
"exists": {
"field": "deviceId"
}
}
]
}
},
"sort": [
{
"timestamp": {
"order": "desc"
}
}
]
}
es常用查询编辑
nsa652232023-12-02 17:05
相关推荐
xieliyu.2 小时前
Java算法精讲:双指针(三)明夜之约2 小时前
Spring Boot 自动装配源码Leaton Lee2 小时前
Spring Boot分层架构详解:从Controller到Service再到Mapper的完整流程Jinkxs2 小时前
Resilience4j- 与 Spring Boot 快速集成:自动配置与基础注解使用辣机小司2 小时前
【踩坑记录:Spring Boot 配置文件读取值不一致?警惕 YAML 的“八进制陷阱”与 SnakeYAML 版本之谜】fangdengfu1233 小时前
ES分析系统各个服务日志占用量云烟成雨TD3 小时前
Spring AI 1.x 系列【51】可观测性技术选型星越华夏3 小时前
ESP32-CAM图像传输项目说明文档Jinkxs4 小时前
Java 跨域14-Java 与区块链(Hyperledger)集成晨曦中的暮雨5 小时前
Golang速通(Javaer版)