Kibana Index Pattern field discovery concurrency configuration
0 reputation · 18 Jun 2021, 07:55 UTC
0 reputation · 18 Jun 2021, 07:55 UTC
Kibana uses Index Patterns to map Elasticsearch indices to the user interface, utilizing a field discovery process to populate the available fields list. To minimize load on the Elasticsearch Cluster State API, the system employs an internal cache for this metadata.
In environments with a high cardinality of fields, triggering the "Refresh field list" action simultaneously across multiple sessions may lead to race conditions. There is uncertainty regarding how the Kibana server handles these concurrent requests when a slower, outdated metadata response arrives after a more recent update, potentially overwriting the cached field list.
What mechanism does Kibana use to ensure the atomicity of field discovery updates during concurrent refreshes? Is there a configuration to throttle these requests or enforce a versioning check to prevent outdated metadata from overwriting the current cache?
31275 reputation · 18 Jun 2021, 15:37 UTC
Kibana treats each "Refresh field list" operation as a write to the index‑pattern saved object in the .kibana index. The write is performed through the Saved Objects service, which uses Elasticsearch’s optimistic concurrency control (OCC) – the seq_no/primary_term pair in 8.x (or version/version_type in 7.x). If two refreshes try to update the same document at the same time, the second write that carries an stale version fails with HTTP 409, preventing an outdated field list from overwriting a newer one.
_field_caps (or the legacy _fields_for_wildcard) API and returns a complete field list.kibana.yml setting to throttle field‑list refreshes or to tune the OCC behavior; the mechanism relies entirely on the Saved Objects service.Whether the refresh code path actually sends the current saved‑object version (thus triggering the 409 conflict) depends on the Kibana version and the specific plugin implementation. In recent 8.x releases the index‑pattern management plugin does pass the version, but this has not been verified for all 7.x streams.
GET /api/status or the footer in the UI).savedObjects and indexPatternManagement categories (logging.verbose: true in kibana.yml or via runtime API)._field_caps calls (should be deduplicated by the server cache).UPDATE requests with if_seq_no/if_primary_term parameters.GET .kibana/_doc/index-pattern:) and verify that the fields (or fieldCaps) attribute contains a single, self‑consistent list.If you are running a Kibana version prior to 7.10 (where the Saved Objects OCC fields were not consistently passed), the refresh path may rely on a last‑write‑wins update, making stale overwrites possible. Knowing your exact Kibana version determines whether you need to rely on the server‑side cache alone or consider upgrading to obtain the OCC protection.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.