You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Jan Høydahl (Jira)" <ji...@apache.org> on 2026/09/16 21:02:00 UTC
[jira] [Updated] (SOLR-18452) Use Content-Type header to distinguish single JSON document from JSON command object
[ https://issues.apache.org/jira/browse/SOLR-18452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Høydahl updated SOLR-18452:
-------------------------------
Description:
Today the /update/json handler will support docs in an array or a single JSON object.
If a single object is passed, it is ambigous whether to interpret it as a plain JSON document with fields, or to interpret it as Solr's special command JSON with "add", "delete" etc commands as JSON keys. Solr uses the request parameter json.command to distringuish whether the single JSON doc is a command or a document, see SOLR-6294.
This is confusing and non standard.
Instead, Solr should use the standard HTTP header "Content-Type" to know how to interpret the body:
* {{application/json}} will mean plain solr document
* {{application/vnd.solr.commands+json}} will mean a command object
There are two sub tasks for this Jira, one deprecation to land in 10.x and the removal/switch to land in 11.0
was:
Today the /update/json handler will support docs in an array or a single JSON object.
If a single object is passed, it is ambigous whether to interpret it as a plain JSON document with fields, or to interpret it as Solr's special command JSON with "add", "delete" etc commands as JSON keys. Solr uses the request parameter json.command to distringuish whether the single JSON doc is a command or a document, see SOLR-6294.
This is confusing and non standard.
Instead, Solr should use the standard HTTP header "Content-Type" to know how to interpret the body:
* {{application/json}} will mean plain solr document
* {{application/vnd.solr.commands+json}} will mean a command object
There will be two sub tasks for this Jira
# Deprecate the request parameter, and declare that from 11.0 users must use the header (10.x)
# Remove request-param, introduce the header parsing logic as a replacement. (11.0)
> Use Content-Type header to distinguish single JSON document from JSON command object
> ------------------------------------------------------------------------------------
>
> Key: SOLR-18452
> URL: https://issues.apache.org/jira/browse/SOLR-18452
> Project: Solr
> Issue Type: Improvement
> Components: update
> Reporter: Jan Høydahl
> Assignee: Jan Høydahl
> Priority: Major
>
> Today the /update/json handler will support docs in an array or a single JSON object.
> If a single object is passed, it is ambigous whether to interpret it as a plain JSON document with fields, or to interpret it as Solr's special command JSON with "add", "delete" etc commands as JSON keys. Solr uses the request parameter json.command to distringuish whether the single JSON doc is a command or a document, see SOLR-6294.
> This is confusing and non standard.
> Instead, Solr should use the standard HTTP header "Content-Type" to know how to interpret the body:
> * {{application/json}} will mean plain solr document
> * {{application/vnd.solr.commands+json}} will mean a command object
> There are two sub tasks for this Jira, one deprecation to land in 10.x and the removal/switch to land in 11.0
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org