Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch: Allow users to override index pattern per query #29477

Conversation

simianhacker
Copy link
Contributor

What this PR does / why we need it:

This PR adds the ability to override the index pattern per Elasticsearch query. This would allow users to override the index pattern per query and have the added benefit of supporting multiple index patterns on the same visualization.

image

Which issue(s) this PR fixes:

Fixes #20674

Special notes for your reviewer:

I put this PR together as a possible solution for #20674, I'm open to other ideas for solving this problem. I've chosen this as my preferred solution because of the low surface area (code wise) and it provides the maximum benefit because it allows users to mix index patterns in the same visualization.

@dagwieers
Copy link

This is exactly what we need. Currently we have about 10 different Elastic datasources with the only difference being the index pattern. And we are adding more each few months.

Using the "Outer join" transformation we can enrich our query data with information from another "source".

@halfa
Copy link

halfa commented Dec 1, 2020

That would be a welcome addition, opening the possibility to mix indices in a single dashboard

@simianhacker simianhacker marked this pull request as ready for review December 1, 2020 23:05
@simianhacker simianhacker requested a review from a team as a code owner December 1, 2020 23:05
@simianhacker simianhacker requested review from ivanahuckova and removed request for a team December 1, 2020 23:05
@dagwieers
Copy link

@simianhacker Just a heads-up that this branch now has conflicts

@simianhacker
Copy link
Contributor Author

@Elfo404 This has been refactored to the React PR and is ready for review. I also fixed an issue where the Alias input field wasn't being populated correctly.

@dagwieers
Copy link

@simianhacker It is obvious, but important to realize that with this change access to indices is no longer controlled from the data source. So it is important to have Grafana's access properly fine-tuned in Elastic itself.

Which you should be doing anyhow, but may not be the case for everyone running both together today. I think we have to mention this specifically in the release notes when this is merged.

Also, we should probably improve the Elasticsearch data source documentation with guidance on what privileges would work for Grafana. Which is just read on the indices listed:

indices:
- names:
  - your-index-*
  - your-other-index-*
  privileges:
  - read
``

@Elfo404
Copy link
Member

Elfo404 commented Dec 11, 2020

@dagwieers good point. There's also an existing issue regarding this: #5880.

with this change access to indices is no longer controlled from the data source.

That's not completely true as currently there are no checks on which indices can be accessed by using the proxy endpoint, that's actually why this PR works.

IMHO it should not be Grafana's (or this plugin's) responsibility to enforce this kind of "safety" measures since it will only provide a false sense of security. What do you think?

Anyway, I agree that the documentation will benefit from having a bit more information on that matter.

@stale
Copy link

stale bot commented Dec 25, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 2 weeks. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale Issue with no recent activity label Dec 25, 2020
@dagwieers
Copy link

Please do not forget about this one 😉

@stale stale bot removed the stale Issue with no recent activity label Dec 28, 2020
@simianhacker simianhacker requested a review from a team as a code owner December 28, 2020 19:26
@simianhacker simianhacker requested review from wbrowne and ying-jeanne and removed request for a team December 28, 2020 19:26
@henrikno
Copy link

This is going to reduce the number of datasources we have to create by at least 50x.

@simianhacker
Copy link
Contributor Author

@henrikno That's awesome to hear.

@stale
Copy link

stale bot commented Mar 20, 2021

This pull request has been automatically marked as stale because it has not had activity in the last 2 weeks. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale Issue with no recent activity label Mar 20, 2021
@hikerspath
Copy link

This was marked for v8, any updates on when this could go live? Would be SUPER useful to be sure. I could reduce about 35 datasources to 1

@stale stale bot removed the stale Issue with no recent activity label Mar 26, 2021
@grafanabot grafanabot added area/frontend area/backend pr/external This PR is from external contributor labels Apr 2, 2021
@CLAassistant
Copy link

CLAassistant commented Apr 20, 2021

CLA assistant check
All committers have signed the CLA.

@ivanahuckova ivanahuckova removed their request for review April 29, 2021 13:46
@ying-jeanne ying-jeanne removed their request for review May 10, 2021 15:16
@danielmotaleite
Copy link

This is really needed!
any hint when this will be merged

@hikerspath
Copy link

Likewise, very curious...

@Elfo404
Copy link
Member

Elfo404 commented Jul 12, 2021

Sorry for the late update, this one slipped through a bit :)

we have some refactoring planned for the ES data source, moving most of the logic to the BE which will hopefully solve quite a few pending issues (especially when it comes to alerting).

That said, this PR is actually conflicting with some of the decisions and concerns that arose when discussing the feature request, so (also together with @simianhacker ) we decided to pause the work being done here and pick it up as soon as possible once the migration is completed.

I understand it's not the answer you were hoping for, but I want to confirm this PR has not been forgotten, we just need to do some prep work before moving forward.

@stale
Copy link

stale bot commented Jul 30, 2021

This pull request has been automatically marked as stale because it has not had activity in the last 2 weeks. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale Issue with no recent activity label Jul 30, 2021
@wbrowne wbrowne removed their request for review March 2, 2022 15:07
@grafanabot
Copy link
Contributor

This pull request has been automatically closed because it has not had activity in the last 2 weeks. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@grafanabot grafanabot closed this Mar 23, 2022
@cjabrantes
Copy link

cjabrantes commented May 2, 2024

Hi,

Can someone confirm this one? i was needed this, but seems its not available yet.

Can this also be used with remote cluster?

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend area/frontend datasource/Elasticsearch pr/external This PR is from external contributor stale Issue with no recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selectable Index Patterns for Elasticsearch DataSources