In Elasticsearch, to match a given text in a field, you will do it this way:
GET /_search
{
"query":{
"match":{
"country": "France"
}
}
}
The must_not
bool query
Similarly, to identify records whose field value does NOT match a given query string, you can do so
using a must_not
boolean query:
GET /_search
{
"query": {
"bool": {
"must_not": [
{
"term": {
"country": "France"
}
}
]
}
}
}
If this looks a bit verbose, you can also get the same
results using a query_string
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.