Elasticsearch查询不得与字段中的文本匹配 [英] Elasticsearch query must not match text from field
本文介绍了Elasticsearch查询不得与字段中的文本匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获得与 statusCode不匹配的结果:200
I want to get the results that do not match "statusCode": 200
要匹配字段中的文本,请使用
In order to match text from field you use
GET index01/_search?pretty
{
"query":{
"match":{
"statusCode": 200
}
}
}
像这样的东西:
GET ucs_heartbeat/_search?pretty
{
"query":{
"match":{
"statusCode":{
"query": 200,
"operator": "must_not"
}
}
}
}
根据: https://www.elastic.co/guide/en/elasticsearch/reference/current/ query-dsl-bool-query.html
推荐答案
试试看
GET ucs_heartbeat/_search?pretty
{
"query": {
"bool": {
"must_not": [
{
"term": {
"statusCode": 200
}
}
]
}
}
}
这篇关于Elasticsearch查询不得与字段中的文本匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文