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

[Discover][ES|QL] Improve changing of index pattern performance #169835

Closed
Tracked by #167595
kertal opened this issue Oct 25, 2023 · 3 comments
Closed
Tracked by #167595

[Discover][ES|QL] Improve changing of index pattern performance #169835

kertal opened this issue Oct 25, 2023 · 3 comments
Assignees
Labels
Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Discover Discover Application Feature:ES|QL impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort performance Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph)
Projects

Comments

@kertal
Copy link
Member

kertal commented Oct 25, 2023

When using ES|QL, there's a different index pattern entered, behind the scenes there's a request for all fields started. This request needs to be completed for the actual data fetching to be started. This step is necessary to get information if there's a @timestamp field available and of type date. Here's the code:

const dataViewObj = await services.dataViews.create({
title: indexPatternFromQuery,
});
if (dataViewObj.fields.getByName('@timestamp')?.type === 'date') {
dataViewObj.timeFieldName = '@timestamp';
}
return dataViewObj;

What can be improved here is to just request what's needed, which is the information of the availability of the field. When DataViewLazy is available (#167750), this can be improved to just fetch the one field of interest. This can significantly boost performance, when the field list takes a long time to load.

Testing kibana_sample_data_logs in DevTools

  • the request for the single field took 0.4s instead of 0.4-0.6s
  • It mostly beneficial that less payload has to be transfered

Testing a large logs index pattern in DevTools

  • the request for the single field took 0.3-0.7 instead of 1.5 - 2.5s

Testing a large CCS metrics index pattern in DevTools:

  • the request for the single field took 3-4s instead of 15s-21s
  • excluding frozen tiers on top 1-3s
    So the time to result would be 14-17s faster

Testing a large CCS logs index pattern in DevTools:

  • the request for the single field took 0.7 - 1.1s instead of 4s-9s
  • excluding frozen tiers on top and the request took just 0.5-0.6s
    So the time to result would be 3.5-8.4s faster

What's more, depending on the implementation of the cache the field cache #169622 we could also use the fields cache the get the information, if the index pattern fields have already been requested, before sending an request to ES.

@kertal kertal added Feature:Discover Discover Application performance Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) Feature:ES|QL labels Oct 25, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@kibanamachine kibanamachine added this to Inbox in Discover Oct 25, 2023
@kertal kertal added Feature:Data Views Data Views code and UI - index patterns before 8.0 loe:medium Medium Level of Effort loe:small Small Level of Effort impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. and removed loe:medium Medium Level of Effort labels Nov 28, 2023
@mattkime
Copy link
Contributor

@kertal I think this need some more detail before its ready to be worked on. Its easy to get a single field but this call is being made in the context of code that expects the full field list to be available. So while I could load a single field its possible that other code would quickly load the whole field list anyway. I see two ways of thinking about this - one in terms of state loading - can we be certain that using DataViewLazy in a certain code path would delay loading the field list until after some other event? Or do we want to introduce DataViewLazy to various layers of discover until its widespread enough that it hits the field list loading bottlenecks?

@kertal
Copy link
Member Author

kertal commented Mar 29, 2024

Thx for the research @mattkime. It looks like this is tightly coupled to a general switch to DataGridLazy consumption in Discover, which is a bigger task. During the research in #179120 mentioned, we can improvement but showing a loading indicator when an ES|QL query takes care of the data view initialization before the query is sent to ES
I'm closing this in favor of #179703

@kertal kertal closed this as completed Mar 29, 2024
@kertal kertal closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Discover Discover Application Feature:ES|QL impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort performance Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph)
Projects
No open projects
Development

No branches or pull requests

3 participants