Add a self-contained v8 search schema revision (PP-4659) - #3522
Conversation
v8 subclasses SearchSchemaRevision directly and defines its full mapping inline, instead of chaining off v7 the way earlier revisions did. With the chain broken, old revisions can be deleted once production no longer uses them. v8 also pins number_of_shards to 1. Earlier indexes inherited a 5-primary-shard count from the Elasticsearch 6.x era, carried forward through every reindex because nothing set it explicitly. Per-library indexes are well under a gigabyte, so a single primary shard is correct, and the setting is immutable after index creation. number_of_replicas is left to runtime management.
v8 now sets index.search.slowlog.threshold.* on every index it creates, so slow query- and fetch-phases are written to the cluster slow log. Paired with the SEARCH_SLOW_LOGS publishing wired up in the hosting-playbook, these entries reach the domain's CloudWatch log group for investigation. The thresholds are dynamic settings, so they establish a baseline at index creation that can still be retuned on a live index without a reindex.
v8 now sets number_of_replicas explicitly (to 1) alongside number_of_shards, so a newly created index has a fully deterministic configuration rather than relying on an inherited cluster default. One replica matches what every production index already runs and is also the OpenSearch default, so this is operationally a no-op. The setting is dynamic and can still be retuned at runtime for a larger topology.
|
Claude finished @jonathangreen's task in 2m 12s —— View job Code Review
SummaryThis is a clean, well-scoped change. The self-contained design is sound, the mapping faithfully reproduces v7 (the DetailsMinor:
|
Greptile SummaryThis PR introduces
Confidence Score: 5/5Safe to merge. The new revision is self-contained, the mapping is byte-for-byte identical to v7 (verified by the fidelity test), and the only behavioural difference — explicit index settings — is intentional and tested. The implementation is a faithful, self-contained copy of the v7 mapping with the addition of pinned index settings. The logic is straightforward, tests are comprehensive (version number, inheritance invariant, settings key presence, and full field/analysis parity with v7), and there are no data-path changes that could affect production search behaviour. Previously flagged issues (mutable class constants, the posessive typo) were deliberately retained for mapping fidelity with the older schema chain. No files require special attention. Important Files Changed
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3522 +/- ##
==========================================
+ Coverage 93.44% 93.46% +0.01%
==========================================
Files 511 512 +1
Lines 46483 46561 +78
Branches 6343 6344 +1
==========================================
+ Hits 43437 43516 +79
+ Misses 1969 1968 -1
Partials 1077 1077 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I'm going to leave this one unmerged until I get back from vacation, so I'm around when it rolls out, in case the new shard settings cause any issues. |
Description
Adds a self-contained v8 OpenSearch schema revision (
SearchV8) and registers it in the revision directory.Unlike earlier revisions, which chained off one another (
SearchV7->SearchV6->SearchV5), v8 subclassesSearchSchemaRevisiondirectly and defines its complete mapping (analyzers, filters, and fields) inline. Breaking the chain means each revision stands alone, so an old revision's module can simply be deleted once nothing in production is using it.Schema-wise v8 is equivalent to v7 (the full v5 mapping plus v6's
lane_priority_leveland v7'slicensepools.last_updated). The mapping is unchanged; the differences are all in the index settings, which v8 now pins explicitly so a newly created index is fully deterministic rather than relying on inherited cluster defaults:number_of_shards = 1— earlier indexes inherited a 5-primary-shard count from the original Elasticsearch 6.x defaults, carried forward through every reindex because nothing set it explicitly. Per-library indexes are well under a gigabyte, far below the per-shard target for search workloads, so a single primary shard is correct. This setting is immutable after index creation, so it must be set up front.number_of_replicas = 1— matches what every production index already runs and is also the OpenSearch default, so this is operationally a no-op. It is a dynamic setting and can still be retuned at runtime for a larger topology; it is pinned only so indexes are created with a known replica count.index.search.slowlog.threshold.*— seeds slow-query-log thresholds on every index this revision creates, so slow query- and fetch-phases are written to the cluster slow log. Paired with theSEARCH_SLOW_LOGSpublishing wired up in the hosting playbook, these entries reach the domain's CloudWatch log group. These are dynamic settings, so they establish a baseline at index creation that can still be retuned on a live index without a reindex.Motivation and Context
The revision chain meant no old schema version could be removed without breaking the revisions built on top of it, so deprecated versions accumulated indefinitely. Making each revision self-contained lets old versions be deleted once production no longer uses them.
Pinning the index settings replaces inherited, undocumented cluster defaults with an explicit, deterministic configuration — most importantly the shard count, which is immutable after index creation and had been silently carried over from the Elasticsearch era.
JIRA: PP-4659
How Has This Been Tested?
Added
tests/manager/search/test_search_v8.py, covering the version number, registration in the revision directory, the pinned shard/replica counts, and the seeded slow-query-log thresholds in the generated mapping document. Ran the search test suite under the docker tox environment.Checklist