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 Hup Chen <ch...@hotmail.com> on 2020/05/21 00:49:56 UTC
Solr Atomic update change value and field name
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}]
}
Re: Solr Atomic update change value and field name
Posted by Hup Chen <ch...@hotmail.com>.
> 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 <ja...@cominvent.com>
Sent: Friday, May 22, 2020 4:46 AM
To: solr-user@lucene.apache.org <so...@lucene.apache.org>
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 <ch...@hotmail.com>:
>
> 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}]
> }
>
>
Re: Solr Atomic update change value and field name
Posted by Jan Høydahl <ja...@cominvent.com>.
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 <ch...@hotmail.com>:
>
> 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}]
> }
>
>