随笔 - 321  文章 - 0  评论 - 6  阅读 - 34万

es常用接口

1、删除query匹配的doc

POST /rally-results-2021-04/_delete_by_query
{
"query": {
"match": {
"user-tags.tag_cluster_name": "es-benchmark-search3data1replicas"
}
}
}

 

2、前缀查询

{
"query": {
"prefix": {
"user-tags.tag_cluster_name": "es-benchmark-search"
}
}
}

 3、删除index

 4、查看分片状态

GET /_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED

5、正则匹配

{
"query": {
"wildcard": {
"user-tags.tag_cluster_name": "es-benchmark-search?*2replicas"
}
}
}

 6、查看es集群的http接口

GET /_cat/nodes?v&h=n,r,http

 7、多条件组合查询

bool常用于多条件组合查询

filter:返回必须满足子条件的doc,搜索结果不计算得分,会用缓存

term常用于精确值搜索

POST 索引名/_search
{
"query": {
"bool": {
"filter": [
{
"term": {
"log_id": "xxxxxx"
}
},
{
"term": {
"space": "gddd_001"
}
},
{
"range": {
"ice_level": {
"gte": 0,
"lt": 6
}
}
},
{
"range":{
"client_timestamp": {
"gte": 1612137806000,
"lte": 1612184606000
}
}
}
]
}
},
"sort": { "@timestamp": { "order": "desc" }}
}

8、查询metricbeat中old gc time

GET /metricbeat-*/_search
{
"query":{
"bool":{
"filter":[
{
"exists": {
"field": "elasticsearch.node.stats.jvm.gc.collectors.old.collection.ms"
}
},
{
"range": {
"@timestamp": {
"gte": "2021-06-23T02:34:00.000Z",
"lte": "2021-06-23T02:35:00.000Z"
}
}
}
]
}
}
}

posted on   该用户很懒  阅读(896)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
历史上的今天:
2020-04-20 elastic python api
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示