-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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: Selected field shows with wrong icon when switching from unmapped to mapped #201751
Comments
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
I believe this is caused by data view field list caching: #168910. We use a stale while revalidate caching strategy which means field list results can be outdated for a single request when fields change while the latest results are fetched in the background. This happens at the browser cache level so we don't currently have programatic control over the caching unfortunately. The issue resolves itself by continuing to use Kibana since fields are frequently requested, so results aren't outdated for long. For example, in your provided test case the fields are synced after refreshing Discover a second time or after executing more searches. It was a tradeoff we made when implementing caching since we believed it was more important for users to get field list results fast than results to be synced immediately. |
Hmm, but it shows the right icon in "Available fields" right below, so it does know about the updated type in the browser memory. |
If the UI would consistently show the field as unmapped I agree that it is OK, I was mostly hung up by the inconsistency in the field list / data grid |
one addon, it's a secondary request, uncached, determining if it's available or not. opening the browser, and deactivating caching, could be used to figure out if it's caching that causing it. (Looks like this on the first sight / read) |
As @kertal mentioned, it's because there are two separate Also as @kertal mentioned, this goes away when deactivating the browser cache. But since we're getting the updated fields from the sidebar request in this case anyway, we could likely figure out a way to sync those updated results back to the data view so it gets the updated fields too. I'm just not immediately sure what that effort would involve so we'd need to investigate more. |
Not a super critical one, I just noticed it when working on the streams effort which will make going from unmapped to mapped much more common |
We could use the secondary request to update mappings of the primary request, if fields have changed ... or to trigger a reload of the primary one. However this is not a low hanging fruit. I'd treat this an potential UX enhancement for this case, not as a bug, as it works like expected. |
Why are we doing two requests anyway? That seems inefficient, right? Wouldn't it make sense to pull the state management of this thing a level higher and serve all consumers with it? |
I disagree here - if it would just be outdated but consistent in the UI, then yes, it's just a UX enhancement. But if it's inconsistent on a single page, that's a bug. Doesn't have to change the priority though, I'll leave that up to you. I expect with the streams effort progressing we'll find more things like this because we are using Elasticsearch a bit different than usual, so we hit different edge cases (like elastic/elasticsearch#117544 which surfaced this way as well) |
There's 1 initial request when selectiing the data view. The secondary request for available fields is a follow up of every search request. I do agree it would be more efficient if fields where returned with the search request. And that's what happens using ES|QL
Thx for raising awareness for this, fine with that, let's treat it as a bug with low priority 👍 |
The first is unfiltered for all fields in the data view when instantiated (this is cached for subsequent requests), and the other is from the field list with an
I don't think it's just a single page, the data view field list will always be one request out of date once cached across all of Kibana where data views are used. The inconsistency here is that Discover attempts to remedy this in its own field list when it detects a mismatch, but there's a flaw in this logic, so I still think considering it a bug is appropriate. I dug into it more today and I overlooked something originally (mainly what makes this a bug/unexpected): We are actually already trying to detect this in Discover and correct it when we notice the field list is outdated. We typically expect one kibana/packages/kbn-unified-field-list/src/services/field_existing/field_existing_utils.ts Lines 60 to 67 in f8860e9
This is how the available fields section gets updated after refreshing even though the data view field list is served from the cache. It looks like there's just a bug in the logic since selected fields are handled differently than the other sections. I'm assuming we can likely fix this, although it won't address the broader issue of cached data view field lists being outdated for a single request. Relevant PR for reference: #172329. |
Kibana version: main
Describe the bug: When a selected field changes from unmapped to mapped in a data view, it is shown with the wrong icon even after a refresh. The field needs to be removed and re-added for the icon to update.
Steps to reproduce:
test
field:Expected behavior:
Field is consistently shown as keyword field everwhere
Screenshots (if relevant):
Errors in browser console (if relevant):
Provide logs and/or server output (if relevant):
Any additional context:
The text was updated successfully, but these errors were encountered: