ES实战--wildcard正则匹配&exists过滤字段是否存在

wildcard 通配符中的 * 表示任意数量的字符
?表示任意单个字符

bash 复制代码
#正则匹配
GET /wildcard-test/_search
{
  "query": {
    "wildcard": {
      "title": {
        "wildcard": "ba*n"
      }
    }
  }
}
#响应:
  "hits": {
    "total": {
      "value": 2,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "wildcard-test",
        "_id": "1",
        "_score": 1,
        "_source": {
          "title": "The Best Bacon Ever"
        }
      },
      {
        "_index": "wildcard-test",
        "_id": "2",
        "_score": 1,
        "_source": {
          "title": "How to raise a barn"
        }
      }
    ]
  }

exists过滤器

bash 复制代码
#过滤出某个字段有值的文档
GET /get-together/_search
{
  "query": {
    "bool": {
      "filter": {
        "exists": {"field": "location_event.geolocation"}
      }
    }
  }
}
相关推荐
Elasticsearch13 小时前
从 137,306 行日志定位到一个故障副本:在 Kibana 中排查错误激增
elasticsearch
Elasticsearch16 小时前
State 即将弃用,由 cpu.mode 接替:在 Elastic 中迁移 OpenTelemetry 进程指标
elasticsearch
岳涛17 小时前
考古|ES 5.3 三条改动只提前打招呼,布尔宽松写法到 6.0 才真正拒绝
elasticsearch
Elasticsearch17 小时前
谁在发起请求?为 Amazon Bedrock AgentCore 智能体配置按用户划分的 Elasticsearch 访问权限
elasticsearch
Elasticsearch18 小时前
Elasticsearch 日志写入提速:用 3 项设置和 logsdb_columnar 从每秒 5.2 万行提升到 11.2 万行
elasticsearch
Elastic 中国社区官方博客20 小时前
Elastic 获得全新的 AWS 数据能力认证
大数据·人工智能·elasticsearch·搜索引擎·ai·云计算·aws
Elasticsearch2 天前
Elastic 获得全新的 AWS 数据能力认证
elasticsearch
Elasticsearch2 天前
Elastic 安全借助 NVIDIA Nemotron 为物理隔离的安全运营中心提供智能体人工智能
elasticsearch
Elasticsearch2 天前
NVIDIA Nemotron 现已在 Elastic 推理服务(EIS)中可用
elasticsearch