Skip to content

Commit 9fd22ea

Browse files
committed
Clarify PIT search keep alive
1 parent 1fade20 commit 9fd22ea

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/Search/SearchRequest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ public function searchAfter(array $searchAfter): self
125125
}
126126

127127
/**
128-
* Set the point in time definition.
128+
* Set the point in time definition for this search request.
129+
*
130+
* The keep alive value is optional when searching with an existing PIT.
129131
*
130132
* @see https://docs.opensearch.org/latest/api-reference/search-apis/point-in-time-api/
131133
*

tests/Unit/Search/SearchRequestTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@
9898
], $request->toArray());
9999
});
100100

101+
test('array casting with point in time without keep alive', function () {
102+
$request = new SearchRequest([
103+
'match_all' => new stdClass,
104+
]);
105+
106+
$request->pit('pit-id');
107+
108+
expect($request->toArray())->toEqual([
109+
'body' => [
110+
'query' => [
111+
'match_all' => new stdClass,
112+
],
113+
'pit' => [
114+
'id' => 'pit-id',
115+
],
116+
],
117+
]);
118+
});
119+
101120
test('array casting with query and rescore', function () {
102121
$request = new SearchRequest([
103122
'match_all' => new stdClass,

0 commit comments

Comments
 (0)