0
0
Elasticsearchquery~10 mins

Point-in-time API 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 open a point-in-time (PIT) for the index named 'products'.

Elasticsearch
POST /products/_pit
{
  "[1]": "1m"
}
Drag options to blanks, or click blank then click option'
Akeep_alive
Btimeout
Cduration
Dexpire
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'timeout' instead of 'keep_alive' causes the PIT to not open correctly.
Using 'duration' or 'expire' are not valid parameters here.
2fill in blank
medium

Complete the code to use the point-in-time ID stored in variable 'pit_id' in a search request.

Elasticsearch
POST /products/_search
{
  "pit": {
    "id": [1]
  },
  "query": {
    "match_all": {}
  }
}
Drag options to blanks, or click blank then click option'
A"pit_id"
BpitId
C"pitId"
Dpit_id
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the variable name in quotes makes it a string literal, not the variable value.
Using a different variable name like 'pitId' causes errors.
3fill in blank
hard

Fix the error in the code to close a point-in-time (PIT) using the correct HTTP method.

Elasticsearch
[1] /_pit
{
  "id": "abc123"
}
Drag options to blanks, or click blank then click option'
ADELETE
BPOST
CGET
DPUT
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET causes a method not allowed error.
Using DELETE is incorrect for closing PIT in Elasticsearch.
4fill in blank
hard

Fill both blanks to create a search request that uses a PIT and sorts results by timestamp descending.

Elasticsearch
POST /logs/_search
{
  "pit": {
    "id": [1],
    "keep_alive": "1m"
  },
  "sort": [
    {"[2]": "desc"}
  ]
}
Drag options to blanks, or click blank then click option'
Apit_id
Btimestamp
Cdate
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string literal instead of the variable for PIT ID.
Sorting by a wrong field name like 'date' or 'time' if not present.
5fill in blank
hard

Fill all three blanks to create a Python snippet that opens a PIT, performs a search using it, and then closes the PIT.

Elasticsearch
pit_response = client.open_point_in_time(index="events", keep_alive="2m")
pit_id = pit_response['[1]']

search_response = client.search(index="events", body={
    "pit": {"id": pit_id, "keep_alive": "2m"},
    "query": {"match_all": {}}
})

client.[2](body={"[3]": pit_id})
Drag options to blanks, or click blank then click option'
A_pit_id
Bid
Cclose_point_in_time
Ddelete_point_in_time
Attempts:
3 left
💡 Hint
Common Mistakes
Using '_pit_id' instead of 'id' key causes KeyError.
Using 'delete_point_in_time' method does not exist.
Wrong body key when closing PIT causes failure.