Skip to content

Conversation

@luigidellaquila
Copy link
Contributor

@luigidellaquila luigidellaquila commented Nov 25, 2025

Adding project routing to the request body and to the configuration.
It will be used for index resolution.
This also adds validation, so that this option can only be set in a context where CPS is enabled.

The existing SET parameter is still supported, and will have precedence on the request body setting, ie. in

{
   "query": """
          SET project_routing="foo"; FROM ...
      """,
   "project_routing": "bar"
}

the resulting value for project routing will be "foo".

clusterSettings.timeseriesResultTruncationMaxSize(),
clusterSettings.timeseriesResultTruncationDefaultSize()
clusterSettings.timeseriesResultTruncationDefaultSize(),
statement.setting(QuerySettings.PROJECT_ROUTING)
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly we should also be able to take it from other places (request field and cluster state, I do not remember the order of preference)?
Should we start implementing it as part of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it makes sense to start adding support for this in the scope of this PR
I'm on it (ref. ES-13390)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, now we have project_routing also in the request body.
Users will be able to set both, and SET parameter will have precendence.

I also added some basic validation, to prevent usage in contexts where CPS is not enabled

@luigidellaquila luigidellaquila marked this pull request as ready for review November 26, 2025 09:45
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 26, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@luigidellaquila luigidellaquila changed the title ES|QL: Add project routing to the configuration ES|QL: Add project routing to request body and configuration Nov 26, 2025
if (projectRouting == null) {
projectRouting = request.projectRouting();
}
if (projectRouting != null && executionInfo.isCrossClusterSearch() == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

executionInfo.isCrossClusterSearch() == false is misleading.

We are populating project routing before FC call (as intended), but executionInfo.clusterInfo that is backing this condition is populated after. I believe it is only passing because executionInfo.isCrossClusterSearch() happens to be false for empty/non-initialized data structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right, I don't know why I picked executionInfo, I should have used CrossProjectModeDecider.
Let me fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@luigidellaquila luigidellaquila enabled auto-merge (squash) November 27, 2025 08:33
@luigidellaquila luigidellaquila merged commit ecd5f9a into elastic:main Nov 27, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants