Reputation: 6159
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
}
}
}
I tried something like this:
GET ucs_heartbeat/_search?pretty
{
"query":{
"match":{
"statusCode":{
"query": 200,
"operator": "must_not"
}
}
}
}
According to: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
Upvotes: 18
Views: 61889
Reputation: 357
A possible string query could be:
{
"query": {
"query_string": {
"query": "NOT statusCode: 200"
}
},
"size": 10,
"from": 0,
"sort": []
}
Upvotes: 0
Reputation: 217254
Try this instead
GET ucs_heartbeat/_search?pretty
{
"query": {
"bool": {
"must_not": [
{
"term": {
"statusCode": 200
}
}
]
}
}
}
Upvotes: 37