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"}
      }
    }
  }
}
相关推荐
Elastic 中国社区官方博客1 天前
更少的位数,相同的召回率:DiskBBQ 更保守的自动校准扫描
大数据·运维·开发语言·人工智能·elasticsearch·搜索引擎
Elasticsearch1 天前
Kibana 中的人工智能连接器:你的 agent 可调用的 90 多个数据源
elasticsearch
Elasticsearch2 天前
更少的位数,相同的召回率:DiskBBQ 更保守的自动校准扫描
elasticsearch
瑞克-桑切斯3 天前
docker Harbor 单机部署手册
大数据·运维·elasticsearch·docker·容器
Elasticsearch5 天前
对 OpenTelemetry Kafka 接收器的两项改动,避免一个缓慢的租户拖住其他租户
elasticsearch
全栈陈序员6 天前
Git】从入门到精通(八)—— git log:查看提交历史
大数据·git·elasticsearch
Percep_gan6 天前
Linux中安装gitea,很详细
linux·elasticsearch·gitea
木棉软糖7 天前
5 步确认 TiDB 历史抽数的 Logstash 有没有真的写进 ES
elasticsearch·oracle·tidb
全栈陈序员7 天前
【Git】从入门到精通(十一)—— git reset 三种模式详解
git·elasticsearch
Elasticsearch7 天前
Elasticsearch:稠密向量字段类型
elasticsearch