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"}
      }
    }
  }
}
相关推荐
Elasticsearch1 天前
Kibana 中的 SNMP 拓扑数据:从采集到 Canvas
elasticsearch
Elasticsearch3 天前
3个信号、2个环境变量、0个采集器:使用 Python 和 Elastic 的托管 OTLP 端点实现 OpenTelemetry
elasticsearch
Elasticsearch5 天前
如何通过 Claude Code 来写入 CSV 数据到 Elasticsearch
elasticsearch
大志哥1237 天前
ES和Logstash日志链路系统上线后遭遇切片爆炸(解决)
大数据·elasticsearch
TableRow7 天前
参数化搜索的实现原理:从多维索引到查询优化
elasticsearch·全文检索
醉颜凉7 天前
Elasticsearch高性能优化:Bulk API大规模数据导入性能调优全攻略
elasticsearch·性能优化·jenkins
Ysouy7 天前
Spring Data Elasticsearch 全流程学习教程
java·spring·elasticsearch
沪飘大军7 天前
goldRush-专门分析黄金的投资理财agent
java·开发语言·elasticsearch
让学习成为一种生活方式7 天前
samblaster v.0.1.26安装与使用--生信工具096
大数据·elasticsearch·搜索引擎