查询指定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
相关推荐
白鸽(二般)8 小时前
MinIO Java Client API软萌萌的18 小时前
Java Spring Boot 修改yml配置&加载顺序规则IT小盘9 小时前
13-企业Prompt模板-角色任务约束与输出格式爱敲键盘的猴子9 小时前
Java并发编程 -- volatileplainGeekDev11 小时前
工厂模式 → HiltplainGeekDev11 小时前
Application 单例 → Hilt Singleton888CC++11 小时前
C语言与C++的区别:从面向过程到面向对象学者猫头鹰12 小时前
分布式事务实战教程heimeiyingwang13 小时前
【架构实战】Kubernetes调度器深度剖析:从Pod调度到自定义调度器笨蛋不要掉眼泪14 小时前
RabbitMQ消息队列:MQ的可靠性