Skip to content

[Ready] SOLR-10424: The sample no longer sets mapUniqueKeyOnly for /update/json/docs, so each posted field is indexed under its own name - #5159

Draft
nick-boss-tech wants to merge 7 commits into
apache:mainfrom
nick-boss-tech:solr-10424-submit
Draft

nick-boss-tech wants to merge 7 commits into
apache:mainfrom
nick-boss-tech:solr-10424-submit

Conversation

@nick-boss-tech

@nick-boss-tech nick-boss-tech commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖 (posted on behalf of Nick Shanin)

Ready for review, but held as a draft due to the project's open-PR cap; I'll mark it open on request.

https://issues.apache.org/jira/browse/SOLR-10424

What happens today

Posting JSON documents to /update/json/docs on the techproducts example stores only the id and the _src_ copy.

Before this change, the sample's params.json set mapUniqueKeyOnly to true in the _UPDATE_JSON_DOCS set (params.json at the base). The /update/json/docs handler reads that set (implicit handler at the base). The sample's default df is text (solrconfig at the base). So the other values go into text with no field name. That field is indexed but not stored (schema at the base), so no field is indexed under its own name.

What this change does

The sample no longer sets mapUniqueKeyOnly for /update/json/docs, so each posted field is indexed under its own name.

The srcField setting stays, so the _src_ copy is still stored. A copy of the old params.json keeps the old behavior.

A field that the sample schema does not define now fails the request. The sample schema has no catch-all field: the * dynamic field is commented out (schema), and the sample solrconfig has no chain that adds unknown fields. Before this change, those values were copied into text without their names.

A post with no id still gets a generated one. The json-docs-uuid chain, which the sample's /update/json/docs path selects, adds a UUID when id is missing, as the reference guide describes. The V2 update endpoints, /api/collections/<name>/update and /api/collections/<name>/update/json, select the same chain, so they generate one too (UpdateAPI).

A choice to check

The sample no longer has the id-only default.

The options are:

  1. Remove the default from the sample, as this change does. Posted fields are indexed under their names.
  2. Keep the default and give the id-only mode its own named set, so the sample behaves as it did.

Option 1 costs a new error for any post with a field the sample schema lacks. Option 2 keeps the behavior this ticket reports as unusable.

Was removing the default the right call for the example, or should the id-only mode stay as the default?

Limits

Some cases are untested, and the order of this change and SOLR-8240 matters.

  • SolrExampleTests.testArbitraryJsonIndexing posts a document with no id. Commit b0a03a5226e adds name queries to it; the class passed at that commit (42 tests, 0 failures, 1 skipped), and with only the sample solrconfig reverted to the base version the test fails, because the posted document gets no generated id without the json-docs-uuid chain.
  • The unknown-field failure described above is not tested.
  • SOLR-8240 changes how mapUniqueKeyOnly treats f. Until this default is gone, requests to the sample that send f fail under that change, so this change should land before, or together with, SOLR-8240.

Changelog: changelog/unreleased/SOLR-10424-techproducts-json-docs.yml

Proof

TechproductsJsonDocsParamsTest passed 1 of 1 at b0a03a5226e. The test fails on the base code.

  • TechproductsJsonDocsParamsTest.testUpdateJsonDocsParamSetDoesNotDropFields (test) reads the sample params.json. It checks that the _UPDATE_JSON_DOCS set keeps srcField and has no mapUniqueKeyOnly.
  • On the base code (cabedd1d968), with only this test file added, the test fails once, on the mapUniqueKeyOnly check.
  • Counts at b0a03a5226e: TechproductsJsonDocsParamsTest 1 of 1, and SolrExampleJsonTest 42 tests with 0 failures and 1 skipped. The params test reads the file. It does not post a document.
  • The id-less V2 path: TechproductsV2IdlessUpdateTest passed 2 of 2 at 5f38ba54a8, counted from fresh JUnit XML (seed 10424C0FFEE10424). At 5b087b1a389 the same test fails: the V2 post to /api/collections/tp/update/json returns HTTP 400, Document is missing mandatory uniqueKey field: id. The /update/json/docs post passes at both commits.
  • Commit 5b087b1a389 only retitles the changelog fragment; the retitled fragment parses, and no code changed between it and b0a03a5226e. Commit 5f38ba54a8 adds the V2 update chain in UpdateAPI and the V2 test below.

AI assistance

AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.

@nick-boss-tech
nick-boss-tech marked this pull request as ready for review October 16, 2026 06:48
@nick-boss-tech nick-boss-tech changed the title SOLR-10424: The sample no longer sets mapUniqueKeyOnly for /update/json/docs, so each posted field is indexed under its own name [Ready] SOLR-10424: The sample no longer sets mapUniqueKeyOnly for /update/json/docs, so each posted field is indexed under its own name Oct 28, 2026
@nick-boss-tech
nick-boss-tech marked this pull request as draft October 28, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant