0
0
Elasticsearchquery~10 mins

Exists query in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if the field "user" exists in the document.

Elasticsearch
{
  "query": {
    "exists": {
      "field": "[1]"
    }
  }
}
Drag options to blanks, or click blank then click option'
Auser
Bname
Cage
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Using a field name that does not exist in the document.
Forgetting to put the field name as a string.
2fill in blank
medium

Complete the code to find documents where the field "status" exists.

Elasticsearch
{
  "query": {
    "exists": {
      "field": "[1]"
    }
  }
}
Drag options to blanks, or click blank then click option'
Astatus
Buser
Cdate
Dlocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using a field name unrelated to the query purpose.
Misspelling the field name.
3fill in blank
hard

Fix the error in the exists query to check for the field "email".

Elasticsearch
{
  "query": {
    "exists": {
      "field": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
Aemail
Bemail_field
C"email"
D'email'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the field name.
Using single quotes instead of double quotes.
4fill in blank
hard

Fill both blanks to create an exists query checking for the field "address.city".

Elasticsearch
{
  "query": {
    "exists": {
      "[1]": "[2]"
    }
  }
}
Drag options to blanks, or click blank then click option'
Afield
Baddress.city
Ccity
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using "city" instead of "address.city".
Using incorrect key names like "value".
5fill in blank
hard

Fill all three blanks to create an exists query inside a bool must clause checking for "profile.age".

Elasticsearch
{
  "query": {
    "bool": {
      "[3]": [
        {
          "exists": {
            "[1]": "[2]"
          }
        }
      ]
    }
  }
}
Drag options to blanks, or click blank then click option'
Afield
Bprofile.age
Cage
Dmust
Attempts:
3 left
💡 Hint
Common Mistakes
Using "age" instead of "profile.age".
Using wrong keys like "value" or missing the bool must clause.