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 Jean-Sebastien Vachon <je...@wantedanalytics.com> on 2014/03/28 20:02:41 UTC
Update single field through SolrJ
Hi All,
I`d like to know how (it is possible) to update a field`s value using SolrJ. I looked at the API and could not figure it out so for now I'm using the UpdateHandler by sending it a JSON formatted document illustrating the required changes.
Is there a way to do the same through SolrJ?
Thanks
RE: Update single field through SolrJ
Posted by Jean-Sebastien Vachon <je...@wantedanalytics.com>.
Hi,
Thanks for pointing me in the proper direction. I managed to change my code to send atomic updates through SolrJ but this morning we experienced something weird. I sent a large batch of updates and deletes through SolrJ and our Cloud quickly became unusable and unresponsive (no leader for a shard, etc).
We looked through the logs and could not find a particular reason for this. We waited quite some time but some nodes were not showing any progress in their recovery so we restarted them (we are running Tomcat 7.0.39) and everything came back as if nothing happened.
Does anyone experienced something similar? We are currently running Solr 4.6.1 on a 5 nodes cluster with both ZK 3.4.5 and Solr on them (ZK has its own storage device to minimize the impact). Both are also running under JRE 1.7.0_21 in 64 bits mode. Our index has 5 shards with 2 replicas.
Thanks for your help
> -----Original Message-----
> From: Shawn Heisey [mailto:solr@elyograg.org]
> Sent: March-28-14 3:21 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Update single field through SolrJ
>
> On 3/28/2014 1:02 PM, Jean-Sebastien Vachon wrote:
> > I`d like to know how (it is possible) to update a field`s value using SolrJ. I
> looked at the API and could not figure it out so for now I'm using the
> UpdateHandler by sending it a JSON formatted document illustrating the
> required changes.
> >
> >
> > Is there a way to do the same through SolrJ?
>
> The feature you are after is called Atomic Updates. In order to use this
> feature *all* of your fields must be stored, except for copyField destinations.
> See especially the "Caveats and Limitations" section of the first link below:
>
> http://wiki.apache.org/solr/Atomic_Updates
> https://cwiki.apache.org/confluence/display/solr/Updating+Parts+of+Docu
> ments
>
> To do this with SolrJ, you must use a Map for the field value instead of just
> one or more regular values:
>
> http://stackoverflow.com/questions/16234045/solr-how-to-use-the-new-
> field-update-modes-atomic-updates-with-solrj
>
> Thanks,
> Shawn
>
>
> -----
> Aucun virus trouvé dans ce message.
> Analyse effectuée par AVG - www.avg.fr
> Version: 2014.0.4354 / Base de données virale: 3722/7256 - Date:
> 27/03/2014
Re: Update single field through SolrJ
Posted by Shawn Heisey <so...@elyograg.org>.
On 3/28/2014 1:02 PM, Jean-Sebastien Vachon wrote:
> I`d like to know how (it is possible) to update a field`s value using SolrJ. I looked at the API and could not figure it out so for now I'm using the UpdateHandler by sending it a JSON formatted document illustrating the required changes.
>
>
> Is there a way to do the same through SolrJ?
The feature you are after is called Atomic Updates. In order to use
this feature *all* of your fields must be stored, except for copyField
destinations. See especially the "Caveats and Limitations" section of
the first link below:
http://wiki.apache.org/solr/Atomic_Updates
https://cwiki.apache.org/confluence/display/solr/Updating+Parts+of+Documents
To do this with SolrJ, you must use a Map for the field value instead of
just one or more regular values:
http://stackoverflow.com/questions/16234045/solr-how-to-use-the-new-field-update-modes-atomic-updates-with-solrj
Thanks,
Shawn