0
0
Elasticsearchquery~10 mins

Boosting 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 boosting query that lowers the score of documents matching the negative query.

Elasticsearch
{
  "query": {
    "boosting": {
      "positive": { "match_all": {} },
      "negative": { "term": { "status": "archived" } },
      "[1]": 0.2
    }
  }
}
Drag options to blanks, or click blank then click option'
Ascore
Bnegative_boost
Cboost
Dweight
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'boost' instead of 'negative_boost' causes an error.
Using 'score' or 'weight' are not valid parameters here.
2fill in blank
medium

Complete the code to boost documents matching the positive query with a higher score.

Elasticsearch
{
  "query": {
    "boosting": {
      "positive": { "match": { "title": "[1]" } },
      "negative": { "term": { "status": "draft" } },
      "boost": 1.5
    }
  }
}
Drag options to blanks, or click blank then click option'
Aelasticsearch
Bpython
Cjavascript
Djava
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated programming languages as the match term.
Leaving the match term empty causes no boost.
3fill in blank
hard

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

Elasticsearch
{
  "query": {
    "boosting": {
      "positive": { "match": { "content": "search" } },
      "negative": { "term": { "status": "deprecated" } },
      "[1]": 0.1
    }
  }
}
Drag options to blanks, or click blank then click option'
Aweight
Bscore
Cnegative_boost
Dboost
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'boost' instead of 'negative_boost' causes errors.
Using 'score' or 'weight' are invalid here.
4fill in blank
hard

Fill both blanks to create a boosting query that boosts documents with 'python' in the title and lowers score for status 'obsolete'.

Elasticsearch
{
  "query": {
    "boosting": {
      "positive": { "match": { "title": "[1]" } },
      "negative": { "term": { "status": "[2]" } },
      "boost": 2.0
    }
  }
}
Drag options to blanks, or click blank then click option'
Apython
Bjava
Cobsolete
Ddraft
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up positive and negative query terms.
Using unrelated status values.
5fill in blank
hard

Fill all three blanks to create a boosting query that boosts documents with 'cloud' in description, lowers score for status 'inactive', and sets boost factor to 0.3.

Elasticsearch
{
  "query": {
    "boosting": {
      "positive": { "match": { "description": "[1]" } },
      "negative": { "term": { "status": "[2]" } },
      "[3]": 0.3
    }
  }
}
Drag options to blanks, or click blank then click option'
Acloud
Binactive
Cnegative_boost
Dactive
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'active' instead of 'inactive' for negative query.
Using wrong field name instead of 'negative_boost'.