本文主要是介绍ES实战--wildcard正则匹配exists过滤字段是否存在,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
wildcard 通配符中的 * 表示任意数量的字符
?表示任意单个字符
#正则匹配
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过滤器
#过滤出某个字段有值的文档
GET /get-together/_search
{"query": {"bool": {"filter": {"exists": {"field": "location_event.geolocation"}}}}
}
这篇关于ES实战--wildcard正则匹配exists过滤字段是否存在的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!