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"}
      }
    }
  }
}
相关推荐
Elasticsearch8 小时前
从课程表到 AI 岗位:我如何用 Elastic Agent Builder 构建 SkillGap Radar
elasticsearch
Database_Cool_12 小时前
日志存储降本首选:阿里云 Lindorm 冷热分层替代 Elasticsearch
elasticsearch·阿里云·云计算
Elasticsearch12 小时前
从多模态 LLM 中引导构建音频嵌入
elasticsearch
Elasticsearch13 小时前
一笔交易,三个字段名称:使用 ECS 修复大型机数据
elasticsearch
Elasticsearch14 小时前
4 个英伟达人工智能任务,1 个 Elasticsearch 接口:嵌入、聊天、completion 和重排序
elasticsearch
IT新视界1 天前
Elasticsearch信创国产化替代
大数据·elasticsearch·搜索引擎
Elasticsearch1 天前
用 Elasticsearch 的 RRF 融合检索,把矿物鉴定准确率从 36% 拉到 92%
elasticsearch
Elasticsearch1 天前
景枢:基于 Elastic AI Agent Builder 的多景区购票智能运维中枢技术解析
elasticsearch
嗝屁小孩纸1 天前
Maven版本升级&Nexus推送极简执行步骤
java·elasticsearch·maven
布局呆星2 天前
Git基础操作:从本地提交到远程仓库
大数据·elasticsearch·搜索引擎