You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Brent Ryan <br...@gmail.com> on 2013/10/18 22:59:03 UTC

SOLRJ replace document

How do I replace a document in solr using solrj library?  I keep getting
this error back:

org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
Atomic document updates are not supported unless <updateLog/> is configured

I don't want to do partial updates, I just want to replace it...


Thanks,
Brent

Re: SOLRJ replace document

Posted by Brent Ryan <br...@gmail.com>.
I wish that was the case but calling addDoc() is what's triggering that
exception.

On Friday, October 18, 2013, Jack Krupansky wrote:

> To "replace" a Solr document, simply "add" it again using the same
> technique used to insert the original document. The "set" option for atomic
> update is only used when you wish to selectively update only some of the
> fields for a document, and that does require that the update log be enabled
> using <updateLog>.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Brent Ryan
> Sent: Friday, October 18, 2013 4:59 PM
> To: solr-user@lucene.apache.org
> Subject: SOLRJ replace document
>
> How do I replace a document in solr using solrj library?  I keep getting
> this error back:
>
> org.apache.solr.client.solrj.**impl.HttpSolrServer$**RemoteSolrException:
> Atomic document updates are not supported unless <updateLog/> is configured
>
> I don't want to do partial updates, I just want to replace it...
>
>
> Thanks,
> Brent
>

Re: SOLRJ replace document

Posted by Jack Krupansky <ja...@basetechnology.com>.
To "replace" a Solr document, simply "add" it again using the same technique 
used to insert the original document. The "set" option for atomic update is 
only used when you wish to selectively update only some of the fields for a 
document, and that does require that the update log be enabled using 
<updateLog>.

-- Jack Krupansky

-----Original Message----- 
From: Brent Ryan
Sent: Friday, October 18, 2013 4:59 PM
To: solr-user@lucene.apache.org
Subject: SOLRJ replace document

How do I replace a document in solr using solrj library?  I keep getting
this error back:

org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
Atomic document updates are not supported unless <updateLog/> is configured

I don't want to do partial updates, I just want to replace it...


Thanks,
Brent 


Re: SOLRJ replace document

Posted by Jason Hellman <jh...@innoventsolutions.com>.
Keep in mind that DataStax has a custom update handler, and as such isn't exactly a vanilla Solr implementation (even though in many ways it still is).  Since updates are co-written to Cassandra and Solr you should always tread a bit carefully when slightly outside what they perceive to be norms.


On Oct 18, 2013, at 7:21 PM, Brent Ryan <br...@gmail.com> wrote:

> So I think the issue might be related to the tech stack we're using which
> is SOLR within DataStax enterprise which doesn't support atomic updates.
> But I think it must have some sort of bug around this because it doesn't
> appear to work correctly for this use case when using solrj ...  Anyways,
> I've contacted support so lets see what they say.
> 
> 
> On Fri, Oct 18, 2013 at 5:51 PM, Shawn Heisey <so...@elyograg.org> wrote:
> 
>> On 10/18/2013 3:36 PM, Brent Ryan wrote:
>> 
>>> My schema is pretty simple and has a string field called solr_id as my
>>> unique key.  Once I get back to my computer I'll send some more details.
>>> 
>> 
>> If you are trying to use a Map object as the value of a field, that is
>> probably why it is interpreting your add request as an atomic update.  If
>> this is the case, and you're doing it because you have a multivalued field,
>> you can use a List object rather than a Map.
>> 
>> If this doesn't sound like what's going on, can you share your code, or a
>> simplification of the SolrJ parts of it?
>> 
>> Thanks,
>> Shawn
>> 
>> 


Re: SOLRJ replace document

Posted by Brent Ryan <br...@gmail.com>.
So I found out the issue here...  It was related to what you guys said
regarding the Map object in my document.  The problem is that I had data
being serialized from DB -> .NET -> JSON and some of the fields in .NET was
== System.DBNull.Value instead of null.  This caused the JSON serializer to
write out an object (ie. Map) so when these fields got deserialized into
the SolrInputDocument it had the Map objects as you indicated.

Thanks for the help! Much appreciated!


On Sat, Oct 19, 2013 at 12:58 AM, Jack Krupansky <ja...@basetechnology.com>wrote:

> By all means please do file a support request with DataStax, either as an
> official support ticket or as a question on StackOverflow.
>
> But, I do think the previous answer of avoiding the use of a Map object in
> your document is likely to be the solution.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Brent Ryan
> Sent: Friday, October 18, 2013 10:21 PM
> To: solr-user@lucene.apache.org
> Subject: Re: SOLRJ replace document
>
>
> So I think the issue might be related to the tech stack we're using which
> is SOLR within DataStax enterprise which doesn't support atomic updates.
> But I think it must have some sort of bug around this because it doesn't
> appear to work correctly for this use case when using solrj ...  Anyways,
> I've contacted support so lets see what they say.
>
>
> On Fri, Oct 18, 2013 at 5:51 PM, Shawn Heisey <so...@elyograg.org> wrote:
>
>  On 10/18/2013 3:36 PM, Brent Ryan wrote:
>>
>>  My schema is pretty simple and has a string field called solr_id as my
>>> unique key.  Once I get back to my computer I'll send some more details.
>>>
>>>
>> If you are trying to use a Map object as the value of a field, that is
>> probably why it is interpreting your add request as an atomic update.  If
>> this is the case, and you're doing it because you have a multivalued
>> field,
>> you can use a List object rather than a Map.
>>
>> If this doesn't sound like what's going on, can you share your code, or a
>> simplification of the SolrJ parts of it?
>>
>> Thanks,
>> Shawn
>>
>>
>>
>

Re: SOLRJ replace document

Posted by Jack Krupansky <ja...@basetechnology.com>.
By all means please do file a support request with DataStax, either as an 
official support ticket or as a question on StackOverflow.

But, I do think the previous answer of avoiding the use of a Map object in 
your document is likely to be the solution.

-- Jack Krupansky

-----Original Message----- 
From: Brent Ryan
Sent: Friday, October 18, 2013 10:21 PM
To: solr-user@lucene.apache.org
Subject: Re: SOLRJ replace document

So I think the issue might be related to the tech stack we're using which
is SOLR within DataStax enterprise which doesn't support atomic updates.
But I think it must have some sort of bug around this because it doesn't
appear to work correctly for this use case when using solrj ...  Anyways,
I've contacted support so lets see what they say.


On Fri, Oct 18, 2013 at 5:51 PM, Shawn Heisey <so...@elyograg.org> wrote:

> On 10/18/2013 3:36 PM, Brent Ryan wrote:
>
>> My schema is pretty simple and has a string field called solr_id as my
>> unique key.  Once I get back to my computer I'll send some more details.
>>
>
> If you are trying to use a Map object as the value of a field, that is
> probably why it is interpreting your add request as an atomic update.  If
> this is the case, and you're doing it because you have a multivalued 
> field,
> you can use a List object rather than a Map.
>
> If this doesn't sound like what's going on, can you share your code, or a
> simplification of the SolrJ parts of it?
>
> Thanks,
> Shawn
>
> 


Re: SOLRJ replace document

Posted by Brent Ryan <br...@gmail.com>.
So I think the issue might be related to the tech stack we're using which
is SOLR within DataStax enterprise which doesn't support atomic updates.
 But I think it must have some sort of bug around this because it doesn't
appear to work correctly for this use case when using solrj ...  Anyways,
I've contacted support so lets see what they say.


On Fri, Oct 18, 2013 at 5:51 PM, Shawn Heisey <so...@elyograg.org> wrote:

> On 10/18/2013 3:36 PM, Brent Ryan wrote:
>
>> My schema is pretty simple and has a string field called solr_id as my
>> unique key.  Once I get back to my computer I'll send some more details.
>>
>
> If you are trying to use a Map object as the value of a field, that is
> probably why it is interpreting your add request as an atomic update.  If
> this is the case, and you're doing it because you have a multivalued field,
> you can use a List object rather than a Map.
>
> If this doesn't sound like what's going on, can you share your code, or a
> simplification of the SolrJ parts of it?
>
> Thanks,
> Shawn
>
>

Re: SOLRJ replace document

Posted by Shawn Heisey <so...@elyograg.org>.
On 10/18/2013 3:36 PM, Brent Ryan wrote:
> My schema is pretty simple and has a string field called solr_id as my
> unique key.  Once I get back to my computer I'll send some more details.

If you are trying to use a Map object as the value of a field, that is 
probably why it is interpreting your add request as an atomic update.  
If this is the case, and you're doing it because you have a multivalued 
field, you can use a List object rather than a Map.

If this doesn't sound like what's going on, can you share your code, or 
a simplification of the SolrJ parts of it?

Thanks,
Shawn


Re: SOLRJ replace document

Posted by Brent Ryan <br...@gmail.com>.
My schema is pretty simple and has a string field called solr_id as my
unique key.  Once I get back to my computer I'll send some more details.

Brent

On Friday, October 18, 2013, Shawn Heisey wrote:

> On 10/18/2013 2:59 PM, Brent Ryan wrote:
>
>> How do I replace a document in solr using solrj library?  I keep getting
>> this error back:
>>
>> org.apache.solr.client.solrj.**impl.HttpSolrServer$**RemoteSolrException:
>> Atomic document updates are not supported unless <updateLog/> is
>> configured
>>
>> I don't want to do partial updates, I just want to replace it...
>>
>
> Replacing a document is done by simply adding the document, in the same
> way as if you were adding a new one.  If you have properly configured Solr,
> the old one will be deleted before the new one is inserted.  Properly
> configuring Solr means that you have a uniqueKey field in yourschema, and
> that it is a simple type like string, int, long, etc, and is not
> multivalued. A TextField type that is tokenized cannot be used as the
> uniqueKey field.
>
> Thanks,
> Shawn
>
>

Re: SOLRJ replace document

Posted by Shawn Heisey <so...@elyograg.org>.
On 10/18/2013 2:59 PM, Brent Ryan wrote:
> How do I replace a document in solr using solrj library?  I keep getting
> this error back:
>
> org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
> Atomic document updates are not supported unless <updateLog/> is configured
>
> I don't want to do partial updates, I just want to replace it...

Replacing a document is done by simply adding the document, in the same 
way as if you were adding a new one.  If you have properly configured 
Solr, the old one will be deleted before the new one is inserted.  
Properly configuring Solr means that you have a uniqueKey field in 
yourschema, and that it is a simple type like string, int, long, etc, 
and is not multivalued. A TextField type that is tokenized cannot be 
used as the uniqueKey field.

Thanks,
Shawn