Improve query for matching indices when creating index pattern #42045
Labels
enhancement
New value added to drive a business result
Feature:Data Views
Data Views code and UI - index patterns before 8.0
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
Today when creating an index pattern we offer the user a list of indices matching the pattern as they're typing it in. We do this with a search to find the top 200 nonempty matching indices ordered by document count:
This seems to come from here:
kibana/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.js
Lines 48 to 63 in a6b8036
This can be somewhat inefficient on large clusters, because I think it hits every segment of every shard in every matching index in order to compute the document count. In elastic/elasticsearch#44719 is a report of this search taking over 4 seconds.
It's not clear that we need to ask for the largest indices here. If this is not a requirement then it would be at least a little more efficient to set
terminate_after: 1
to stop collecting results after finding the first document in each shard.I also think we should consider doing this via a different route than a search, because really the coordinating node can give a reasonably accurate list of indices without needing to involve any other nodes in the cluster. For instance
GET /pattern*/_field_caps?fields=_anything_
would return all the matching indices straight away. It would also return any empty indices, which seems desirable too.The disadvantage of something like that is in the case where
pattern*
matches a ludicrous number of indices, because today I don't know of a way to limit any responses down to only the first few. We'd be trading off load on Elasticsearch vs time spent downloading too many results. Maybe that's worth it, I'm not sure.The text was updated successfully, but these errors were encountered: