Complete the code to check if the field "user" exists in the document.
{
"query": {
"exists": {
"field": "[1]"
}
}
}The exists query checks if the specified field exists in the document. Here, the field is user.
Complete the code to find documents where the field "status" exists.
{
"query": {
"exists": {
"field": "[1]"
}
}
}The exists query is used to find documents where the status field exists.
Fix the error in the exists query to check for the field "email".
{
"query": {
"exists": {
"field": [1]
}
}
}The field name must be a string in quotes. Without quotes, it causes a syntax error.
Fill both blanks to create an exists query checking for the field "address.city".
{
"query": {
"exists": {
"[1]": "[2]"
}
}
}The key must be "field" and the value the full field name "address.city" to check nested fields.
Fill all three blanks to create an exists query inside a bool must clause checking for "profile.age".
{
"query": {
"bool": {
"[3]": [
{
"exists": {
"[1]": "[2]"
}
}
]
}
}
}The exists query uses the key "field" with value "profile.age". The bool query uses "must" to require this condition.