1 | initial version |
To create a must-exist query in Elasticsearch, you can use the exists query. This query matches documents where a specific field exists, regardless of its value. Here's an example:
{
"query": {
"bool": {
"must": [
{
"exists": {
"field": "name"
}
}
]
}
}
}
This query will return all documents that have a non-null value for the "name" field. If you want to include additional query clauses, you can add them to the "must" array.