lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <m...@apache.org>
Subject Re: Update partial document
Date Tue, 11 Sep 2018 16:32:05 GMT
Hello, Vincenzo.

What about adding 1 into      "attr_" : [ "set" : null ], ?

On Tue, Sep 11, 2018 at 7:23 PM Vincenzo D'Amore <v.damore@gmail.com> wrote:

> Hi Solr gurus :)
>
> I have a delicious question (that I'm struggling with), really hope that
> someone can help me.
>
> There is a document with many fields but I have to modify only few of them.
>
> I thought to use atomic update but it seems that I cannot replace an entire
> list of dynamic fields.
>
> Here I try to explain my problem, for example using the schemaless
> configuration, I have a dynamic field:
>
> <dynamicField name="attr_*" type="text_general" indexed="true"
> stored="true" multiValued="true"/>
>
> And then I have a document :
>
>      {
>         "id":"aaa",
>         "value_i":10,
>         "attr_1":["a"]
>      }
>
> 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" ]
>     }
> ]'
>
> 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 in advance for your time.
> Vincenzo
>
> --
> Vincenzo D'Amore
>


-- 
Sincerely yours
Mikhail Khludnev

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message