Solr Atomic update change value and field name

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr Atomic update change value and field name

Hup Chen
I am new to Solr. I tried to do Atomic update by using .json file update. $SOLR/bin/post not only changing field values, but field name also has become "fieldname.set", for instance, "price" become "price.set".  Update by curl /update handler was working well but since I have several millions of records, I can't update by calling curl several million times, that will be extremely slow.

Any help will be appreciated.


    # /usr/local/solr/bin/solr version
    8.5.1

    # curl http://localhost:8983/solr/books/select?q=id%3A0371558727
    "response":{"numFound":1,"start":0,"docs":[
      {
        "id":"0371558727",
        "price":19.0,
        "_version_":1667214802265571328}]
    }

    # cat test.json
    [
    {"id":"0371558727",
     "price":{"set":19.95}
    }
    ]

    # /usr/local/solr/bin/post -p 8983 -c books test.json

    # curl http://localhost:8983/solr/books/select?q=id%3A0371558727
    "response":{"numFound":1,"start":0,"docs":[
      {
        "id":"0371558727",
        "price.set":[19.95],
        "_version_":1667214933776924672}]
    }


Reply | Threaded
Open this post in threaded view
|

Re: Solr Atomic update change value and field name

Jan Høydahl / Cominvent
Try adding -format solr to your bin/post command. By default the post command will treat input as arbitrary json, not solr-format json.

Jan Høydahl

> 21. mai 2020 kl. 02:50 skrev Hup Chen <[hidden email]>:
>
> I am new to Solr. I tried to do Atomic update by using .json file update. $SOLR/bin/post not only changing field values, but field name also has become "fieldname.set", for instance, "price" become "price.set".  Update by curl /update handler was working well but since I have several millions of records, I can't update by calling curl several million times, that will be extremely slow.
>
> Any help will be appreciated.
>
>
>    # /usr/local/solr/bin/solr version
>    8.5.1
>
>    # curl http://localhost:8983/solr/books/select?q=id%3A0371558727
>    "response":{"numFound":1,"start":0,"docs":[
>      {
>        "id":"0371558727",
>        "price":19.0,
>        "_version_":1667214802265571328}]
>    }
>
>    # cat test.json
>    [
>    {"id":"0371558727",
>     "price":{"set":19.95}
>    }
>    ]
>
>    # /usr/local/solr/bin/post -p 8983 -c books test.json
>
>    # curl http://localhost:8983/solr/books/select?q=id%3A0371558727
>    "response":{"numFound":1,"start":0,"docs":[
>      {
>        "id":"0371558727",
>        "price.set":[19.95],
>        "_version_":1667214933776924672}]
>    }
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Solr Atomic update change value and field name

Hup Chen

> Try adding -format solr to your bin/post command. By default the post command will treat input as arbitrary json, not solr-format json.
Yes, it works!  Thanks a lot!
________________________________
From: Jan Høydahl <[hidden email]>
Sent: Friday, May 22, 2020 4:46 AM
To: [hidden email] <[hidden email]>
Subject: Re: Solr Atomic update change value and field name

Try adding -format solr to your bin/post command. By default the post command will treat input as arbitrary json, not solr-format json.

Jan Høydahl

> 21. mai 2020 kl. 02:50 skrev Hup Chen <[hidden email]>:
>
> I am new to Solr. I tried to do Atomic update by using .json file update. $SOLR/bin/post not only changing field values, but field name also has become "fieldname.set", for instance, "price" become "price.set".  Update by curl /update handler was working well but since I have several millions of records, I can't update by calling curl several million times, that will be extremely slow.
>
> Any help will be appreciated.
>
>
>    # /usr/local/solr/bin/solr version
>    8.5.1
>
>    # curl http://localhost:8983/solr/books/select?q=id%3A0371558727
>    "response":{"numFound":1,"start":0,"docs":[
>      {
>        "id":"0371558727",
>        "price":19.0,
>        "_version_":1667214802265571328}]
>    }
>
>    # cat test.json
>    [
>    {"id":"0371558727",
>     "price":{"set":19.95}
>    }
>    ]
>
>    # /usr/local/solr/bin/post -p 8983 -c books test.json
>
>    # curl http://localhost:8983/solr/books/select?q=id%3A0371558727
>    "response":{"numFound":1,"start":0,"docs":[
>      {
>        "id":"0371558727",
>        "price.set":[19.95],
>        "_version_":1667214933776924672}]
>    }
>
>