Repository navigation
Apply the page feedback mapping to an index that already exists - #5030
Merged
Merged
Conversation
An index created before a field was added keeps its old mapping, because templates only apply when an index is created. `page-feedback-v1-staging` was created before `reasons` replaced `reason`, so with `dynamic: false` its `reasons` were stored but never indexed. Startup now puts the current mapping on the existing index. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The mapping update ran as a raw request beside the ingest channel's bootstrap. It is now an `IBootstrapStep` in the channel's own bootstrap strategy, after the template steps, so the channel handles its failure mode and `PageFeedbackBootstrapService` is unchanged from `main`. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5030/ Sample changed pages: |
The provisioning guide told operators to bump the index version for any mapping change, which contradicted the new in-place update of added fields. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
`PUT <index>/_mapping` needs the `manage` index privilege, which the guide did not list. A key without it gets a 403 and stops startup outside `dev`. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
A missing index is only safe when the templates are already current, because the first write creates the index from them. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
In `dev` the step returned `false` without a trace, and the service then warned that template bootstrap failed even when both templates were installed. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The gateway tests built the channel with the old implicit strategy, so the explicit strategy was only exercised at startup. A new test pins the bulk target and the document id. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The guide repeated the startup failure rule three times and the additive-only rule twice. Simplify pass. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The channel is now built in `PageFeedbackIndex.CreateChannel`. Simplify pass. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The order test already pins the method and path of the mapping request. Simplify pass. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The test counted only requests to the expected path, so a second mapping request to another index would have passed. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
A connection or TLS failure has no HTTP status, and the warning called it an Elasticsearch rejection without the exception. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Elasticsearch answers 200 with `"acknowledged": false` when not every node confirms the update before the timeout. The update still applies and startup continues, but documents written in that window miss the added fields in the index, so the step now says so. Raised in review by Libra. Co-Authored-By: Claude Fable 5.2 <[email protected]>
| // The update is applied either way; only the wait for every node to confirm it timed out. | ||
| if (IsUnacknowledged(response.Body)) | ||
| logger.LogWarning( | ||
| "Not every node acknowledged the mapping update for {IndexName} in time. Documents written before they do are stored without the added fields indexed; run _update_by_query on the index to index them", |
There was a problem hiding this comment.
Severity: P3 (Low)
An acknowledgement timeout doesn't mean any page-feedback writes missed the new mapping. If only a node that doesn't handle those writes was slow to acknowledge, this warning still tells operators to rewrite the whole index with _update_by_query. Say that writes may have been affected, and recommend a backfill only after the mapping has propagated and an indexing gap is confirmed.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Page feedback reasons are now indexed on an index created before the field existed. The ingest channel's bootstrap puts the current mapping on
page-feedback-v1-{env}instead of relying on a template that only applies to new indices.Affects: Docs API
Prompt summary: Checked reasons in the page feedback widget did not show up in Elasticsearch on staging, while edge worked. The ask was to find out why and fix it so a stale index cannot hide a field again.
Why
The index has a fixed name, and its templates apply only when the index is created.
page-feedback-v1-stagingwas created under #3705, when the field wasreason. #4054 renamed it toreasons. The mapping setsdynamic: false, so on stagingreasonsis stored in_sourcebut never indexed. Search, filters and ES|QL cannot see it. The widget, the API and the bulk request all sendreasonscorrectly.What
Bootstrap repairs an existing index
The channel's bootstrap strategy gains a third step after the two template steps.
ExistingIndexMappingStepsendsPUT page-feedback-v1-{env}/_mappingwith the current mapping. Running it again changes nothing. A missing index is fine, because the templates apply on the first write.A rejected mapping stops the deploy
The step follows the channel's bootstrap method, like the built-in steps. A mapping Elasticsearch rejects, such as a type change, fails startup in
staging,edgeandprod. Indevthe step logs the status and the response, and startup continues. A transport failure is logged as one, with its exception. An update that Elasticsearch accepts but not every node acknowledges in time does not stop startup; the step warns about the possible indexing gap. A breaking change then shows up at deploy time and not as silently unindexed data.One place builds the channel
PageFeedbackIndex.CreateChannelcomposes the strategy. The service registration, the bootstrap tests and the gateway write tests all use it, and a gateway test pins the bulk target and the document id.PageFeedbackBootstrapServiceis unchanged.The limits are written down
docs/development/page-feedback.mdnow says that an added field is applied in place and that an incompatible change needs a new index name. It lists themanageindex privilege the update needs, and names the_update_by_querycall that indexes documents written before a field reached the mapping.Verify
With
ExistingIndexMappingStepremoved from the strategy,StartAsync_IndexExists_PutsCurrentMappingOnItandStartAsync_MappingRejectedInStaging_FailsStartupfail. With the step moved before the template steps,StartAsync_IndexExists_InstallsTemplatesBeforeTheMappingfails.Risk: This runs on every API start in
staging,edgeandprod, and a rejected mapping now stops startup there. The request needs themanageindex privilege onpage-feedback-v1-{env}, so a deployed key without it gets a 403 and the API does not start. Confirm the keys before rollout. The fix also does not repair data. Staging needs a one-time repair by a person after the deploy, because the existing documents stay unindexed forreasonsuntil then:Out of scope: The step belongs in
Elastic.Ingest.Elasticsearchas a built-in bootstrap step, and aTODOmarks it for removal once upstream ships one.page-feedback-v1-devand any prod index are not checked here. RunGET page-feedback-v1-<env>/_mappingon each and confirmreasonsis there.🤖 Generated with Claude Code