0
0
Elasticsearchquery~10 mins

Sorting results 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 sort the search results by the field price in ascending order.

Elasticsearch
{
  "sort": [
    {"price": {"order": "[1]"}}
  ]
}
Drag options to blanks, or click blank then click option'
Adesc
Basc
Cup
Ddown
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'desc' instead of 'asc' for ascending order.
Using words like 'up' or 'down' which are not valid.
2fill in blank
medium

Complete the code to sort the results by date in descending order.

Elasticsearch
{
  "sort": [
    {"date": {"order": "[1]"}}
  ]
}
Drag options to blanks, or click blank then click option'
Adesc
Basc
Cascending
Ddescending
Attempts:
3 left
💡 Hint
Common Mistakes
Using full words like 'descending' which are not valid.
Confusing ascending and descending orders.
3fill in blank
hard

Fix the error in the sorting code to sort by rating in ascending order.

Elasticsearch
{
  "sort": [
    {"rating": {"order": "[1]"}}
  ]
}
Drag options to blanks, or click blank then click option'
Adescending
Bup
Casc
Ddown
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid strings like 'descending' or 'down'.
Mixing up ascending and descending.
4fill in blank
hard

Fill both blanks to sort results by price ascending and then by date descending.

Elasticsearch
{
  "sort": [
    {"price": {"order": "[1]"}},
    {"date": {"order": "[2]"}}
  ]
}
Drag options to blanks, or click blank then click option'
Aasc
Bdesc
Cascending
Ddescending
Attempts:
3 left
💡 Hint
Common Mistakes
Using full words like 'ascending' or 'descending' which are invalid.
Mixing the order of sorting directions.
5fill in blank
hard

Fill all three blanks to sort by rating descending, then price ascending, then date descending.

Elasticsearch
{
  "sort": [
    {"rating": {"order": "[1]"}},
    {"price": {"order": "[2]"}},
    {"date": {"order": "[3]"}}
  ]
}
Drag options to blanks, or click blank then click option'
Aasc
Bdesc
Cascending
Ddescending
Attempts:
3 left
💡 Hint
Common Mistakes
Using full words like 'ascending' or 'descending'.
Swapping the order of sorting directions.