Skip to content

Set CPS index options only when not using PIT#137728

Merged
pawankartik-elastic merged 3 commits intoelastic:mainfrom
pawankartik-elastic:pkar/cps-pit
Nov 7, 2025
Merged

Set CPS index options only when not using PIT#137728
pawankartik-elastic merged 3 commits intoelastic:mainfrom
pawankartik-elastic:pkar/cps-pit

Conversation

@pawankartik-elastic
Copy link
Contributor

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, CPS index options are applied, which causes a validation error when TransportAction calls validate().

This PR prevents the CPS index options application when PIT is found in the request's body.

@pawankartik-elastic pawankartik-elastic added >bug Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/CCS labels Nov 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @pawankartik-elastic, I've created a changelog YAML for you.

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Nov 7, 2025
Copy link
Member

@piergm piergm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pawankartik-elastic pawankartik-elastic marked this pull request as ready for review November 7, 2025 16:11
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@pawankartik-elastic pawankartik-elastic merged commit b9ba4bc into elastic:main Nov 7, 2025
34 checks passed
@pawankartik-elastic pawankartik-elastic deleted the pkar/cps-pit branch November 7, 2025 16:15
Kubik42 pushed a commit to Kubik42/elasticsearch that referenced this pull request Nov 10, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Search Foundations/CCS serverless-linked Added by automation, don't add manually Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.3.0

3 participants