0
0
Elasticsearchquery~10 mins

Dis max 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 create a dis_max query with two match queries.

Elasticsearch
{
  "query": {
    "dis_max": {
      "queries": [
        { "match": { "title": "[1]" } },
        { "match": { "description": "search text" } }
      ]
    }
  }
}
Drag options to blanks, or click blank then click option'
Asearch query
Bquery text
Ctext search
Dsearch text
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different phrase than 'search text' in the match query.
Putting the phrase outside the quotes.
2fill in blank
medium

Complete the code to set the tie_breaker parameter to 0.7 in the dis_max query.

Elasticsearch
{
  "query": {
    "dis_max": {
      "tie_breaker": [1],
      "queries": [
        { "match": { "title": "search text" } },
        { "match": { "description": "search text" } }
      ]
    }
  }
}
Drag options to blanks, or click blank then click option'
A0
B0.7
C0.3
D1.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using an integer instead of a decimal.
Setting tie_breaker to 0 or 1 which changes behavior drastically.
3fill in blank
hard

Fix the error in the dis_max query by completing the missing field name.

Elasticsearch
{
  "query": {
    "dis_max": {
      "queries": [
        { "match": { "[1]": "search text" } },
        { "match": { "description": "search text" } }
      ]
    }
  }
}
Drag options to blanks, or click blank then click option'
Atitle
Bcontent
Csummary
Dbody
Attempts:
3 left
💡 Hint
Common Mistakes
Using a field name that does not exist in the index.
Leaving the field name blank or misspelled.
4fill in blank
hard

Fill both blanks to create a dis_max query with a tie_breaker and two match queries on 'title' and 'content'.

Elasticsearch
{
  "query": {
    "dis_max": {
      "tie_breaker": [1],
      "queries": [
        { "match": { "title": "search text" } },
        { "match": { "[2]": "search text" } }
      ]
    }
  }
}
Drag options to blanks, or click blank then click option'
A0.5
B0.9
Ccontent
Ddescription
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid tie_breaker value.
Using the wrong field name for the second match query.
5fill in blank
hard

Fill all three blanks to build a dis_max query with tie_breaker, boost, and two match queries on 'title' and 'summary'.

Elasticsearch
{
  "query": {
    "dis_max": {
      "tie_breaker": [1],
      "boost": [2],
      "queries": [
        { "match": { "title": "search text" } },
        { "match": { "[3]": "search text" } }
      ]
    }
  }
}
Drag options to blanks, or click blank then click option'
A0.3
B1.5
Csummary
Ddescription
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up boost and tie_breaker values.
Using incorrect field names in match queries.