0
0
Elasticsearchquery~10 mins

Cache management (query, request, field data) 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 enable query cache in Elasticsearch.

Elasticsearch
{
  "query": {
    "match_all": {}
  },
  "[1]": true
}
Drag options to blanks, or click blank then click option'
Aquery_cache
Brequest_cache
Ccache_enabled
Dfielddata_cache
Attempts:
3 left
💡 Hint
Common Mistakes
Using request_cache instead of query_cache
Using fielddata_cache which is for field data, not queries
Using a non-existent setting like cache_enabled
2fill in blank
medium

Complete the code to enable request cache for a search request.

Elasticsearch
{
  "size": 10,
  "query": {
    "term": { "user": "kimchy" }
  },
  "[1]": true
}
Drag options to blanks, or click blank then click option'
Aquery_cache
Bfielddata_cache
Crequest_cache
Dcache_query
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing request_cache with query_cache
Using fielddata_cache which is unrelated to request caching
Using incorrect setting names
3fill in blank
hard

Fix the error in the field data cache setting to enable it correctly.

Elasticsearch
{
  "fielddata": {
    "[1]": true
  }
}
Drag options to blanks, or click blank then click option'
Aenable
Bfielddata_cache
Ccache
Dfielddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cache' or 'fielddata_cache' which are invalid keys
Using 'fielddata' again inside the fielddata object
4fill in blank
hard

Fill both blanks to create a query that uses request cache and disables query cache.

Elasticsearch
{
  "query": {
    "match": { "title": "Elasticsearch" }
  },
  "[1]": false,
  "[2]": true
}
Drag options to blanks, or click blank then click option'
Aquery_cache
Brequest_cache
Cfielddata_cache
Dcache_enabled
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the cache names
Using invalid cache names
Setting both caches to true or false
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that caches field lengths greater than 5.

Elasticsearch
{
  "field_lengths_cache": {
    "lengths": {word: len(word) for word in words if len(word) [1] [2],
    "[3]": true
  }
}
Drag options to blanks, or click blank then click option'
A>
B5
Ccache_enabled
Drequest_cache
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators
Using wrong cache keys
Forgetting to enable the cache