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

[EPM] Change index pattern ids or adapt UI #60388

Closed
neptunian opened this issue Mar 17, 2020 · 12 comments
Closed

[EPM] Change index pattern ids or adapt UI #60388

neptunian opened this issue Mar 17, 2020 · 12 comments
Assignees
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@neptunian
Copy link
Contributor

Currently, EPM creates index patterns with unique ids. Eg. for logs-* it is epm-ip-logs. This causes Kibana dashboard app to throw an error if the id is not logs-*. See if we can change safely change the ids or if its an issue with the UI.
screen_shot_2020-03-17_at_9 29 10_am

@neptunian neptunian added the Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project label Mar 17, 2020
@neptunian neptunian self-assigned this Mar 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Feature:EPM)

@ruflin
Copy link
Contributor

ruflin commented Mar 17, 2020

@neptunian I'm good with changing it for now to see if it solves our problem. But I think we also need to fully understand how name of the index pattern and id related as we reference to it in our dashboards / visualization. We must figure out what must be used there and in which fields must be used what. @mtojek Works on some import scripts and found index patterns referenced in quite a few different places.

@neptunian
Copy link
Contributor Author

neptunian commented Mar 17, 2020

Note: Beats creates index patterns with title and id always the same. I had overlooked this initially.

@ruflin Is there a concern that somewhere else is using the same index pattern id/name?

@ruflin
Copy link
Contributor

ruflin commented Mar 18, 2020

One of the concerns could be that we accidentially override and other index pattern created by the user. What is more important here I think is to understand where in visualizations / searches etc. are ids used and where is the name used? Or is it by now always id?

@jen-huang jen-huang added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 26, 2020
@neptunian
Copy link
Contributor Author

neptunian commented Aug 12, 2020

@ruflin

One of the concerns could be that we accidentally override and other index pattern created by the user.

When creating index patterns through the Management app a unique ID is generated such as 4b6f4350-dcac-11ea-9489-d103615882ab and the index pattern itself is the "title". It would probably be best if we did something similar as we changed the ids to be logs-* and metrics-*. Then we would need to update our asset references to point to the more unique ID.

What is more important here I think is to understand where in visualizations / searches etc. are ids used and where is the name used? Or is it by now always id?

Looking at the assets that reference index patterns looks like this:
Screen Shot 2020-08-12 at 10 01 29 AM
This is why we updated the index pattern id to match these references, but we probably should have updated these references to point to the unique id. All other places outside these references that are referencing the saved object type and id, we are most likely going to use the name or "title" as we want the value of the actual index pattern. An example in our assets is: "default_index_pattern": "logs-*" or "series_index_pattern": "logs-*" . These seem to always appear in visState attribute of a visualization.. I tried making my own index pattern with a unique id that doesn't match the title of the index pattern and create a visualization that uses it. I can confirm the index pattern references in the visState is the title and not the id.

We can try changing the ids of the index patterns and updating all references to the saved object type index pattern to this id (in the screenshot).

@ruflin
Copy link
Contributor

ruflin commented Aug 13, 2020

@neptunian What are the changes needed if we follow your recommendation above?

BTW: I think it is kind of odd but title is used as reference and not the id 🤔

@neptunian
Copy link
Contributor Author

neptunian commented Aug 13, 2020

@ruflin we would need to change the id of the index pattern saved object from logs-* to whatever unique one we decide. We would need to do some kind of migration for that if we don't want to introduce a breaking change. I'd update the package install code to start creating the index pattern with this id. Then we'd need to have that package script update all "references" objects id to be the new id.

BTW: I think it is kind of odd but title is used as reference and not the id 🤔

Are you referring to the screenshot I posted? The Beats code uses the same id and title when creating the index pattern so perhaps it was expected for the id to be the title or actual index pattern value here. For references like "default_index_pattern": "logs-*", I think anywhere it asks for the actual index pattern or title in the UI because the user does not know the unique id. That is where the references in the visState are from, user input.

@ruflin
Copy link
Contributor

ruflin commented Aug 14, 2020

Is there an easy way provided by Kibana to update all references or would it mean we have to understand all SO to make sure we put in the right references? Is there a risk that it not only shows up in references but also other places?

I'm starting to wonder if for us it is just easiest to keep also id and title in sync 🤔

@neptunian
Copy link
Contributor Author

neptunian commented Aug 14, 2020

Since you cannot update a SO id through Kibana, I don't think there would be a way to automatically update references to it. I think we would need to update it ourselves, but I think it would only be in this property references. I found this issue and it seems like modifying SO ids can be tricky: #59598 . It lists some other places the id could be. If the user created some assets using the index pattern, they would need to be updated.

I'm starting to wonder if for us it is just easiest to keep also id and title in sync 🤔

I think it is. Other users seem confused by using id vs title. The saved object API to update an index pattern through PUT will only update with a specified ID and not create if it doesn't exist. POST is used to create and you cannot create an index pattern with the same ID as one that already exists so I don't think we'd need to worry about the user accidentally overwriting ours. Since our ID matches the title, it's a way of letting the user know that index pattern title already exists and they shouldn't create one like it. Because if they are trying to use logs-* as an ID they are probably trying to use it as a title as well. It's not possible to have duplicate index pattern titles through Kibana UI but it is through the API, though I don't see any reason someone would want to.

Screen Shot 2020-08-14 at 8 27 18 AM

Screen Shot 2020-08-14 at 8 01 08 AM

@ruflin
Copy link
Contributor

ruflin commented Aug 17, 2020

@neptunian What is your proposed next step?

@neptunian
Copy link
Contributor Author

@ruflin I think we should leave the id and title the same, as it is now.

@ruflin
Copy link
Contributor

ruflin commented Aug 17, 2020

SGTM. Should we close this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests

4 participants