0
0
Elasticsearchquery~10 mins

Document versioning 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 specify the version number when indexing a document.

Elasticsearch
POST /my_index/_doc/1?version=[1]
{
  "name": "Alice"
}
Drag options to blanks, or click blank then click option'
A2
B0
C1
Dlatest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the version number causes errors.
Using 'latest' is not a valid version number.
2fill in blank
medium

Complete the code to update a document only if the version matches.

Elasticsearch
POST /my_index/_doc/1/_update?version=[1]
{
  "doc": {"age": 30}
}
Drag options to blanks, or click blank then click option'
A2
B3
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using an outdated version number causes version conflicts.
Using 0 or 1 when the current version is 2 causes errors.
3fill in blank
hard

Fix the error in the code to prevent version conflicts when deleting a document.

Elasticsearch
DELETE /my_index/_doc/1?version=[1]
Drag options to blanks, or click blank then click option'
A1
B0
Clatest
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or 'latest' causes version conflict errors.
Using an outdated version number causes the delete to fail.
4fill in blank
hard

Fill both blanks to create a document with version control and refresh immediately.

Elasticsearch
PUT /my_index/_doc/2?version=[1]&refresh=[2]
{
  "title": "New Doc"
}
Drag options to blanks, or click blank then click option'
A1
Btrue
Cfalse
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using version 2 for a new document causes conflicts.
Setting refresh to false delays document availability.
5fill in blank
hard

Fill all three blanks to update a document with version check, retry on conflict, and refresh.

Elasticsearch
POST /my_index/_doc/3/_update?version=[1]&retry_on_conflict=[2]&refresh=[3]
{
  "doc": {"status": "active"}
}
Drag options to blanks, or click blank then click option'
A3
B5
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong version numbers causes conflicts.
Not setting retry_on_conflict may cause update failures.
Setting refresh to false delays search availability.