Elasticsearch offers a versatile and powerful way to search for records using the query_string query.

GET /_search
{
    "query": {
    "query_string": {
      "query": "country: France"
    }
}

The NOT operator

Similarly, to find documents whose field value is NOT equal to a given query string, you can do so using the NOT operator.

GET /_search
{
    "query": {
    "query_string": {
      "query": "NOT (country: France)"
    }
}

# or

GET /_search
{
    "query": {
    "query_string": {
      "query": "!(country: France)"
    }
}

If you want to find documents whose field value does not match multiple values, you need to use a space separated list.

GET /_search
{
    "query": {
    "query_string": {
      "query": "NOT (country: France Italy Germany)"
    }
}

NOTE: you can also get the same results using a must_not boolean query.

Elasticsearch can have a steep learning curve. If you're looking for a fast but easier-to-use alternative, take a look at Typesense.