Skip to content

Commit b9ba4bc

Browse files
Set CPS index options only when not using PIT (#137728)
PIT endpoints do not currently support CPS, and their `allowsCrossProject()` method returns `false` anyway. This prevents the Security Action Filter from rewriting the index expressions, and only those indices are used that are provided. However, when the `_search` endpoint is hit with CPS enabled, along with the PIT ID obtained previously by hitting the `_pit` endpoint, CPS index options are applied, which causes a validation error when `TransportAction` calls `validate()`. This change prevents the CPS index options application when PIT is found in the request's body.
1 parent 22c15bc commit b9ba4bc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/changelog/137728.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 137728
2+
summary: Set CPS index options only when not using PIT
3+
area: CCS
4+
type: bug
5+
issues: []

server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public static void parseSearchRequest(
245245
searchRequest.routing(request.param("routing"));
246246
searchRequest.preference(request.param("preference"));
247247
IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, searchRequest.indicesOptions());
248-
if (crossProjectEnabled && searchRequest.allowsCrossProject()) {
248+
if (crossProjectEnabled && searchRequest.allowsCrossProject() && searchRequest.pointInTimeBuilder() == null) {
249249
indicesOptions = IndicesOptions.builder(indicesOptions)
250250
.crossProjectModeOptions(new IndicesOptions.CrossProjectModeOptions(true))
251251
.build();

0 commit comments

Comments
 (0)