Elasticsearch query string query with not equal to?
You need to use the NOT operator, like this:
!(name:"Fred")
or
NOT (name:"Fred")
You can also use a combination of must and must_not. Like pull docs where name is Ajit and status is not queued.
{
"query": {
"bool": {
"must": [
{
"match": {
"name": "Ajit"
}
}
],
"must_not": [
{
"match": {
"status": "queued"
}
}
]
}
}
}
You should use bool query with must_not statement
{
"query": {
"bool" : {
"must_not" : {
"term" : {
"name" : "Fred"
}
}
}
}
}