You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by rajani m <ra...@gmail.com> on 2023/07/24 18:03:26 UTC

Json ambiguous condition b/n a flat and child doc for partial updates

Hi Solr Users,

Sending a partial update in json format to a doc that has only 2 fields {
"id":"10", "contributor_name":"john"} fails with an error as seen below.

{ "id":"10", "contributor_name":{"set":"Doe"}}

Unable to index docs with children: the schema must include definitions for
both a uniqueKey field and the '_root_' field, using the exact same
fieldType => org.apache.solr.common.SolrException: Unable to index docs
with children: the schema must include definitions for both a uniqueKey
field and the '_root_' field, using the exact same fieldType

The same does not fail if the payload is xml.

<add>
  <doc>
    <field name="id">10</field>
    <field name="contributor_name" update="set">"Doe"</field>
  </doc>
</add>

There are no parent child docs in the index and the index has an "id" field
as a unique string type key. There is no _root_ field in the index.

Trying to figure out the cause and any alternative to avoid the issue while
sending doc as json?

Thank you,
Rajani

Re: Json ambiguous condition b/n a flat and child doc for partial updates

Posted by rajani m <ra...@gmail.com>.
The field type is SortableTextField
<https://solr.apache.org/__root/docs.solr.apache.org/docs/8_0_0/solr-core/org/apache/solr/schema/https://solr.apache.org/__root/docs.solr.apache.org/docs/8_0_0/solr-core/org/apache/solr/schema/SortableTextField.html>


On Mon, Jul 24, 2023 at 2:03 PM rajani m <ra...@gmail.com> wrote:

> Hi Solr Users,
>
> Sending a partial update in json format to a doc that has only 2 fields {
> "id":"10", "contributor_name":"john"} fails with an error as seen below.
>
> { "id":"10", "contributor_name":{"set":"Doe"}}
>
> Unable to index docs with children: the schema must include definitions
> for both a uniqueKey field and the '_root_' field, using the exact same
> fieldType => org.apache.solr.common.SolrException: Unable to index docs
> with children: the schema must include definitions for both a uniqueKey
> field and the '_root_' field, using the exact same fieldType
>
> The same does not fail if the payload is xml.
>
> <add>
>   <doc>
>     <field name="id">10</field>
>     <field name="contributor_name" update="set">"Doe"</field>
>   </doc>
> </add>
>
> There are no parent child docs in the index and the index has an "id"
> field as a unique string type key. There is no _root_ field in the index.
>
> Trying to figure out the cause and any alternative to avoid the issue
> while sending doc as json?
>
> Thank you,
> Rajani
>
>