Hi Mikhail, Shawn,

thanks for your prompt answer.
The problem is that the indexed documents have dozen of fields and usually
they are different for each document.

For example document id 1 has few generic fields like title, description
and all the attributes like attr_1224, attr_4343, attr_4454, attr_5345, and
so on (dozen).
document id 2 like the former has its generic fields and attr_435,
attr_165, attr_986, attr_12, and so on (dozen).

In other words, I cannot know for each document I have update what are the
list of attr_# that I have to remove.

In the update request there is only the list of new fields/values that I
have to substitute in the document and yes, this list can be different from
the original document.




On Tue, Sep 11, 2018 at 7:42 PM Shawn Heisey <apa...@elyograg.org> wrote:

> 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
>
>

-- 
Vincenzo D'Amore

Reply via email to