Complete the code to open a point-in-time (PIT) for the index named 'products'.
POST /products/_pit
{
"[1]": "1m"
}The keep_alive parameter sets how long the PIT remains open.
Complete the code to use the point-in-time ID stored in variable 'pit_id' in a search request.
POST /products/_search
{
"pit": {
"id": [1]
},
"query": {
"match_all": {}
}
}The id field expects the variable pit_id without quotes to pass the PIT ID.
Fix the error in the code to close a point-in-time (PIT) using the correct HTTP method.
[1] /_pit { "id": "abc123" }
Closing a PIT requires a POST request to the /_pit endpoint.
Fill both blanks to create a search request that uses a PIT and sorts results by timestamp descending.
POST /logs/_search
{
"pit": {
"id": [1],
"keep_alive": "1m"
},
"sort": [
{"[2]": "desc"}
]
}The PIT ID variable is pit_id, and sorting by timestamp descending orders newest first.
Fill all three blanks to create a Python snippet that opens a PIT, performs a search using it, and then closes the PIT.
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})
The PIT ID is accessed with key id. The method to close PIT is close_point_in_time, and the body key is id.