Repository navigation
SOLR-8240: A request that sends f with mapUniqueKeyOnly=true now fails with a 400 error - #5145
Open
nick-boss-tech wants to merge 4 commits into
Open
nick-boss-tech wants to merge 4 commits into
nick-boss-tech wants to merge 4 commits into
Conversation
nick-boss-tech
marked this pull request as ready for review
October 16, 2026 06:47
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.
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
https://issues.apache.org/jira/browse/SOLR-8240
What happens today
A request to
/update/json/docsthat setsmapUniqueKeyOnly=trueand also sends field mappings (f) succeeds, and the names infare dropped.With
mapUniqueKeyOnly=true, each record keeps only its uniqueKey and thesrcFieldcopy. Every other mapped value goes into the default search field (df) with no field name (pre-change code at the merge-base). A request withf=title:/titleputs the title text intodfand returns success. The nametitlenever reaches the index.What this change does
A request that sends
fwithmapUniqueKeyOnly=truenow fails with a 400 error.The check runs first in
handleSplitMode, before any record is read (check). The error text tells the caller to sendmapUniqueKeyOnly=falseto map fields. This change adds one sentence to the reference guide'smapUniqueKeyOnlysection (guide).The check reads the effective value, so an inherited value counts. A params set or
initParamsthat setsmapUniqueKeyOnly=truemakes each request that sendsffail, unless the request sendsmapUniqueKeyOnly=false. The techproducts sample sets it for/update/json/docs(params.json). Until SOLR-10424 removes that default,frequests to the sample fail with this error. SOLR-10424 is a dependency: this change should land after it, or with it.Proof
JsonLoaderTest passes 33 of 33 and TestInitParams passes 8 of 8 at
78ecddf01f5c. The new tests fail on the code before this change.JsonLoaderTest.testFieldMappingWithMapUniqueKeyOnlyIsRejected(test) sendsf=title:/titlewithmapUniqueKeyOnly=true. It expects a 400 whose message namesmapUniqueKeyOnly.TestInitParams.testUpdateJsonDocsInitParamsRejectsFieldMappings(test) covers the inherited case: withmapUniqueKeyOnly=trueset ininitParams, a request that sendsffails with the same 400, and a request that sendsmapUniqueKeyOnly=falsesucceeds with the fields mapped.78ecddf01f5c: JsonLoaderTest 33 of 33, TestInitParams 8 of 8. Verified 2026-10-15 at that head.A choice to check
The request now fails, where the old code let it succeed and drop the names.
The options are:
fandmapUniqueKeyOnly=trueboth apply. This is the change here. The ticket proposes this error.fin the response or the log. Clients keep working, but the names are still dropped.Option 1 costs a new error for clients that send both, or inherit the value. Option 2 keeps those requests working, but the mismatch stays a warning.
Was the 400 the right call?
Limits
The guide's examples and Setting JSON Defaults section are not updated here.
initParamsdefault, and a request that overrides that default withmapUniqueKeyOnly=false.mapUniqueKeyOnlyas a default. A request that uses that default and sendsfgets the 400. This change does not edit that section. Updating it is a planned follow-up pull request.fexamples for the techproducts sample are not changed here. Threef=txt:/**examples now return 400, and thesplit=/examsexamples already fail on the sample. SOLR-10424 concerns that default.Changelog:
changelog/unreleased/SOLR-8240-map-unique-key-only-f-conflict.ymlAI assistance
AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.