-
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
[Lens] Switch field list filtering to filtered field caps instead of sampling #112782
Comments
can we verify if this implementation change will also effect the field dropdown (that has the same sections)? it would be really great if this changed both places as I have seen #58330 occur (false negatives) in the field list as well |
@ghudgins yes, this is powered by the same underlying information |
Perhaps we could provide @ppisljar @sixstringcode any thoughts |
@mattkime I think this makes a lot of sense (and would be a great fit for our architecture) - just one small note: This function would also need to take time range and current query as arguments (or there needs to be some way to convert them into filters, not sure whether that's easily possible at the moment) |
@flash1293 What format do you have the time range and current query in? Are you using the query bar for this? Looks like there's more flexibility than I initially thought - https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html#search-field-caps-api-request-body At any rate, my goal is to properly pass through the query / filter. We should verify the details of how this should work. |
@mattkime we can move forward with the getFilteredFields change. Does this change apply to the field list in Discover also? |
@mattkime I’m also completely fine with passing a raw Elasticsearch query in there - it’s not an issue to compile filter plus timerange plus query as part of the consumer and it would keep the API flexible. In Lens state, timerange is a data “TimeRange” object, query is a data “Query” object (the ones returned by the query bar ui component) @sixstringcode Discover can’t use this in the current state because the field list is built by the actual loaded documents - this makes it always “correct” in the sense of the doc table and the field list being in sync (this is the main problem we want to solve with this api in Lens) |
I think the function signature would need to be a bit different from what I stated earlier. We'd add functionality to getFieldsForWildcard and create a helper function that takes the dataView and the query. Same final result. Are we certain that all queries could be passed into the field caps call? @flash1293 would passing the raw ES query have type checking? |
not sure what you mean, the Elasticsearch docs state a query object can be passed in (like the one used for search requests) I don’t think we have proper type checking for ES query objects in Kibana. For consumers of the filter bar (like Lens), I think the following should be the easiest to use: then the new function itself would put together the parts into a single Es query |
searchsource doesn't know about timerange (its just a filter for it), dataviews seem a similar level of abstraction, so i would be ok if we just pass in filters and queries |
Sounds fine to me as well |
I might be having trouble understanding the following statement from the docs -
What if it doesn't |
@mattkime Someone from the ES team can provide a more thorough explanation, this is my understanding:
in these cases the query can be broken down to “won’t match anything” per individual shard purely based on shard meta data without looking at the actual data. If this happens for all shards of an index, the index’s fields won’t become part of the final field caps response - this is what we are looking for for Lens. If a field is in the full field list of a data view but not in the filtered field list for the currently applied filters/query/timerange, they are “empty” and hidden from the UI by default, otherwise they are shown as “available”. Based on this, to answer your question directly - if it doesn’t rewrite to match_none, it’s possible the shard contains data that will be included in the current query, so Elasticsearch has to take the fields of the index into account for the response of the fields caps api (marking them “available” in Lens) |
@ppisljar Could you drive the filter / query portion of this interface? Or suggest someone else? Everything looks very straight forward but since I'm not familiar with that portion of the problem I might slow things down. |
I spoke with @ppisljar and we came up with -
Anyway, it seems some of these details might changes but they'd be inconsequential. Does this sound good @flash1293 ? |
@mattkime sounds good to me, this will be fine for our use case. |
This isn't blocked anymore - #121367 gives us the required API. We can call This should be implemented on the server as part of the existing |
Blocked on #95558
The current approach of field list filtering in Lens is problematic because false negatives can occur (see #58330). To fix this in a forward-facing way, it should be replaced by querying the field caps API with the currently applied filters.
As this can negatively affect the behavior of index structures which might still be used by some people, there should be an advanced setting flag to switch back to sampling (similar to how legacy chart implementations are treated). There should be telemetry for this setting - if there is no significant usage, sampling can be removed completely.
The text was updated successfully, but these errors were encountered: