lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: Update partial document
Date Tue, 11 Sep 2018 17:42:01 GMT
On 9/11/2018 10:23 AM, Vincenzo D'Amore wrote:
> I suppose to be able to remove attr_1 and add attr_3 with one atomic update.
>
> Like this:
>
> curl -X POST -H 'Content-Type: application/json' '
> http://localhost:8983/solr/gettingstarted/update?versions=true&commit=true'
> --data-binary '
>   [
>      {
>        "id" : "aaa" ,
>        "attr_" : [ "set" : null ],
>        "attr_3" : [ "set" : "x" ]
>      }
> ]'

This would probably have worked if you had used "attr_1" instead of 
"attr_".  There is no field named "attr_" in your document, so that line 
does nothing.  Fields in atomic updates must be fully specified. I am 
not aware of any kind of wildcard support.

> But as result I only have a new attr_3 field (the field attr_1 is still
> there)
>
>       {
>          "id":"aaa",
>          "value_i":10,
>          "attr_1":["a"],
>          "attr_3":["x"]
>       }
>
> So it seem that, for this particular case, I have first to read the
> document and then I can update it.
>
> Do you think there are other options?
> Can I use the StatelessScriptUpdateProcessorFactory ?
> Should I write my own UpdateProcessor ?

Thanks,
Shawn


Mime
View raw message