-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[ML] Disable dynamic mappings for all ML indices #61083
Comments
Pinging @elastic/ml-core (:ml) |
Problems that would have been easier to work around and recover from if we didn't have dynamic mappings are #37607, #61157 and elastic/kibana#74935. |
elastic/kibana#74935 is caused by a broadly applied dynamic template defined in the Line 9 in de3107a
The template matches every unknown field regardless of inferred type and maps it as a string. Dynamic mappings would have correctly deduced the type and mapped the new field as a boolean if it had not been for this dynamic template. |
Depending on the inferred type dynamic mappings can cause these specific errors: 1. Strings are mapped as multi-fields with
|
We discussed this aspect in the team meeting. One option would be to do something along the lines of what's been done for the transforms internal index, where we stop writing to existing indices with dynamic mappings and instead write to replacement indices that don't have dynamic mappings. The downside is that when we search we need to search both and then deduplicate, favouring the newer index if a particular document exists in both. Another option is to stick with the approach we are using today, of adding mappings to existing indices after upgrade. But to keep us honest we could have an upgrade test that deliberately creates indices with 7.0 mappings before our internal code has a chance to create indices. This will prove that our code can cope with upgrading mappings on a 7.0 index created with dynamic mappings enabled. We would need to keep this test until 8.last, and could remove it in 9.0 (when we will be sure we're fully into a no dynamic mappings on ML internal indices environment). |
#68044 revealed something which solves this problem very nicely for the indices that are becoming system indices: dynamic updates are banned for system indices. This means that from 7.12 onwards, the two system indices whose mappings allow dynamic updates, The approaches outlined in #61083 (comment) are still relevant for the indices that have dynamic mappings and are hidden indices rather than system indices. |
Dynamic mappings cause untold problems for ML. If new mappings aren't added to an ML index as we expect after upgrading then dynamic mappings are created for the new fields. These usually have the wrong types and then cause problems either for searching the index or when we eventually try to put the correct mappings on the index.
In the case where our desired mappings do not get applied for some reason it would be much better if the new fields had no mappings at all than the wrong mappings. At least then it is possible to added the correct mappings at a later time without running into a conflict.
The difficult part is how we get from where we are today to the desired state. Every ML user today has ML indices that have dynamic mappings enabled. We need to continue to work with these indices and safely upgrade them while also gradually moving over to the future world where ML indices do not create dynamic mappings.
Here is a tentative plan:
The biggest risk here is that a few releases after disabling dynamic mappings we forget we ever had them and get lazy about ensuring the latest upgrade code works in situations where the ML indices have dynamic mappings.
The text was updated successfully, but these errors were encountered: