0
0
Elasticsearchquery~10 mins

Infrastructure monitoring 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 query all documents from the 'metrics' index.

Elasticsearch
{
  "index": "metrics",
  "body": {
    "query": {
      "match_all": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A"all"
Bnull
C[]
D{}
Attempts:
3 left
💡 Hint
Common Mistakes
Using null or an array instead of an empty object causes errors.
Putting a string like 'all' is not valid syntax.
2fill in blank
medium

Complete the code to filter documents where the 'status' field is 'active'.

Elasticsearch
{
  "query": {
    "term": {
      "status": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A{ "value": "active" }
Bactive
C"active"
D["active"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted active causes syntax errors.
Using an object or array instead of a string is invalid.
3fill in blank
hard

Fix the error in the aggregation to calculate average CPU usage.

Elasticsearch
{
  "aggs": {
    "avg_cpu": {
      "avg": {
        "field": [1]
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A"cpu_usage"
Bcpu_usage
C"avg_cpu"
Davg_cpu
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around the field name causes errors.
Using aggregation names instead of field names is incorrect.
4fill in blank
hard

Fill both blanks to create a range query filtering memory usage between 4GB and 16GB.

Elasticsearch
{
  "query": {
    "range": {
      "memory": {
        "gte": [1],
        "lte": [2]
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A"4gb"
B"4g"
C"16gb"
D"16g"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'g' instead of 'gb' may not be recognized.
Using numbers without quotes causes errors.
5fill in blank
hard

Fill all three blanks to create a terms aggregation on 'host' filtering buckets with doc_count greater than 10.

Elasticsearch
{
  "aggs": {
    "hosts": {
      "terms": {
        "field": [1]
      },
      "aggs": {
        "filtered_hosts": {
          "bucket_selector": {
            "buckets_path": {
              "count": [2]
            },
            "script": "params.count [3] 10"
          }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A"host.keyword"
B"_count"
C>
D"host"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'host' instead of 'host.keyword' causes aggregation on analyzed text.
Using wrong bucket path or missing quotes causes errors.
Using '<' instead of '>' changes filter logic.