Skip to content

[ES|QL] Fixes lookup indexes route failures on read permissions#233282

Merged
stratoula merged 3 commits intoelastic:mainfrom
stratoula:fix-lookup-route-on-read
Aug 29, 2025
Merged

[ES|QL] Fixes lookup indexes route failures on read permissions#233282
stratoula merged 3 commits intoelastic:mainfrom
stratoula:fix-lookup-route-on-read

Conversation

@stratoula
Copy link
Contributor

@stratoula stratoula commented Aug 28, 2025

Summary

This PR is fixing a bunch of bugs all related with lookup join route.

When you are on an instance with read privileges on indexes and try to use the ES|QL editor you will see 2 problems:

  1. The lookup join route fails with 500
  2. The failure makes the history component to not save anything at the local storage. The reason is that our validation api fails so we cant get the status so the item is not saved at the local storage

After an investigation I found out that:

  • client.indices.getSettings fails when you have read priviliges
  • the client.indices.getAlias fails if you pass an empty array

What I did:

  • changed the client.indices.getSettings to client.indices.resolveIndex which works on read and doesnt return hidden indices
  • I am fetching the aliases from the same api
  • I added the parseMessages to a try catch loop to be sure that even if something fails on the validation the history component will work
@stratoula stratoula added Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// release_note:fix v8.19.3 v9.2.0 backport:version Backport to applied version labels labels Aug 28, 2025
@stratoula stratoula marked this pull request as ready for review August 28, 2025 12:06
@stratoula stratoula requested a review from a team as a code owner August 28, 2025 12:06
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@stratoula stratoula changed the title [ES|QL] Fixes lookup indexes route on read permissions Aug 28, 2025
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
esql 267.0KB 267.0KB +54.0B
Copy link
Contributor

@drewdaemon drewdaemon left a comment

Choose a reason for hiding this comment

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

Code changes make sense to me!

@stratoula stratoula merged commit 3adac4b into elastic:main Aug 29, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/17325020553

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 233282

Questions ?

Please refer to the Backport tool documentation

@stratoula
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

stratoula added a commit to stratoula/kibana that referenced this pull request Aug 29, 2025
…tic#233282)

## Summary

This PR is fixing a bunch of bugs all related with lookup join route.

When you are on an instance with read privileges on indexes and try to
use the ES|QL editor you will see 2 problems:

1. The lookup join route fails with 500
2. The failure makes the history component to not save anything at the
local storage. The reason is that our validation api fails so we cant
get the status so the item is not saved at the local storage

After an investigation I found out that:

- client.indices.getSettings fails when you have read priviliges
- the client.indices.getAlias fails if you pass an empty array

What I did:

- changed the client.indices.getSettings to client.indices.resolveIndex
which works on read and doesnt return hidden indices
- I am  fetching the aliases from the same api
- I added the parseMessages to a try catch loop to be sure that even if
something fails on the validation the history component will work

(cherry picked from commit 3adac4b)

# Conflicts:
#	src/platform/plugins/shared/esql/server/services/esql_service.ts
ymao1 pushed a commit to ymao1/kibana that referenced this pull request Aug 29, 2025
…tic#233282)

## Summary

This PR is fixing a bunch of bugs all related with lookup join route.

When you are on an instance with read privileges on indexes and try to
use the ES|QL editor you will see 2 problems:

1. The lookup join route fails with 500
2. The failure makes the history component to not save anything at the
local storage. The reason is that our validation api fails so we cant
get the status so the item is not saved at the local storage

After an investigation I found out that:

- client.indices.getSettings fails when you have read priviliges
- the client.indices.getAlias fails if you pass an empty array

What I did:

- changed the client.indices.getSettings to client.indices.resolveIndex
which works on read and doesnt return hidden indices
- I am  fetching the aliases from the same api
- I added the parseMessages to a try catch loop to be sure that even if
something fails on the validation the history component will work
jkelas pushed a commit to jkelas/kibana that referenced this pull request Sep 2, 2025
…tic#233282)

## Summary

This PR is fixing a bunch of bugs all related with lookup join route.

When you are on an instance with read privileges on indexes and try to
use the ES|QL editor you will see 2 problems:

1. The lookup join route fails with 500
2. The failure makes the history component to not save anything at the
local storage. The reason is that our validation api fails so we cant
get the status so the item is not saved at the local storage

After an investigation I found out that:

- client.indices.getSettings fails when you have read priviliges
- the client.indices.getAlias fails if you pass an empty array

What I did:

- changed the client.indices.getSettings to client.indices.resolveIndex
which works on read and doesnt return hidden indices
- I am  fetching the aliases from the same api
- I added the parseMessages to a try catch loop to be sure that even if
something fails on the validation the history component will work
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 2, 2025
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @stratoula

1 similar comment
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @stratoula

@stratoula stratoula removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 4, 2025
@stratoula stratoula added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels v8.19.3 labels Sep 4, 2025
@stratoula
Copy link
Contributor Author

Backported a part of it here #233949

stratoula added a commit that referenced this pull request Sep 4, 2025
…es permission (#233949)

## Summary

I could not backport #233282 as
the ES api is different but I am backporting the most important part of
the fix which is allowing the history component to work properly when
there is a 500 error in the lookup index route
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana release_note:fix Team:ESQL ES|QL related features in Kibana t// v9.2.0

4 participants