Migrate watcher to system indices infrastructure#67588
Migrate watcher to system indices infrastructure#67588pugnascotia merged 21 commits intoelastic:masterfrom
Conversation
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/es-core-features (Team:Core/Features) |
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
@elasticmachine update branch |
|
There's something very peculiar going on here. As far as I can tell:
|
I think the issue is that watches have dynamic objects within the mapping including metadata among others. So when the watch is stored with metadata then the mappings need to be updated to account for the In order to resolve this, I think a change is needed to how mappings are validated. If a mapping contains dynamic fields then any fields contained within that object should be allowed. Make sense? |
|
@elasticmachine update branch |
| module.addIndexOperationListener(listener); | ||
| } | ||
|
|
||
| static void validAutoCreateIndex(Settings settings, Logger logger) { |
There was a problem hiding this comment.
👍 (never liked this logic here)
| builder.field("dynamic", "strict"); | ||
| { | ||
| builder.startObject("_meta"); | ||
| builder.field("version", Version.CURRENT); |
There was a problem hiding this comment.
The current template doesn't have a version field under they _meta object.
If I read the code correctly in SystemIndexManager this means that irregardless of that, a mapping update will be triggered?
There was a problem hiding this comment.
@martijnvg it turns out that the SystemIndexManager would never have updated the mappings, because without a value for _metadata.version, the manager would always think that the version was the latest (because Version.fromString(null) returns Version.CURRENT). I've pushed a fix for that case.
`SystemIndexManager.readMappingVersion` didn't take into account that calling `Version.readString(null)` would return `Version.CURRENT`, which would mean that an index with version metadata would never have its mappings updated. Change the logic to return `Version.EMPTY` in this case, so that the mappings will be updated.
086ebdf to
ce2d550
Compare
Part of elastic#61656. Migrate the `.watches` and `.triggered_watches` system indices to use the auto-create infrastructure. The watcher history indices are left alone. As part of this work, a `SystemIndexDescriptor` now inspects its mappings to determine whether it has any dynamic mappings. This influences how strict Elasticsearch is with enforcing the descriptor's mappings, since ES cannot know in advanced what all the mappings will be. This PR also fixes the `SystemIndexManager` so that (1) it doesn't fall over when attempting to inspect the state of an index that hasn't been created yet, and (2) does update mappings if there's no version field in the mapping metadata.
Backport of #67588. Part of #61656. Migrate the `.watches` and `.triggered_watches` system indices to use the auto-create infrastructure. The watcher history indices are left alone. As part of this work, a `SystemIndexDescriptor` now inspects its mappings to determine whether it has any dynamic mappings. This influences how strict Elasticsearch is with enforcing the descriptor's mappings, since ES cannot know in advanced what all the mappings will be. This PR also fixes the `SystemIndexManager` so that (1) it doesn't fall over when attempting to inspect the state of an index that hasn't been created yet, and (2) does update mappings if there's no version field in the mapping metadata.
Since #67588, .triggered_watches and .watches indices are no longer created on node startup. This PR removing them from the warnings for comparison.
Since elastic#67588, .triggered_watches and .watches indices are no longer created on node startup. This PR removing them from the warnings for comparison.
Since elastic#67588, .triggered_watches and .watches indices are no longer created on node startup. This PR removing them from the warnings for comparison.
We moved watcher to run on the system indices infrastructure in elastic#67588. This commit makes sure Watcher cleans up the legacy templates it used before it was migrated to system indices.
Part of #61656.
Migrate the
.watchesand.triggered_watchessystem indices to use the auto-create infrastructure. The watcher history indices are left alone.As part of this work, a
SystemIndexDescriptornow inspects its mappings to determine whether it has any dynamic mappings. This influences how strict Elasticsearch is with enforcing the descriptor's mappings, since ES cannot know in advanced what all the mappings will be.This PR also fixes the
SystemIndexManagerso that it doesn't fall over when attempting to inspect the state of an index that hasn't been created yet.