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"}
}
}
}
}