简体   繁体   中英

Update the value of a specific field in solr

I am trying to update the value of existing field in solr document to a new value using curl.Below is the query and response. But I do not see the value for code getting reflected in solr. Please help to resolve the issue.

curl  -X POST -H 'Content-Type: application/json' 'http://localhost:8390/solr/collection/update' -d '[{"id" : “12345”,”code” : {"set" : “500”}}]’
{
  "responseHeader":{
    "rf":1,
    "status":0,
    "QTime":11}}

Looks like you have missed the commit=true in your request and hence the issue.

Try the below command and hopefully it should work for you.

curl  -X POST -H 'Content-Type: application/json' 'http://localhost:8390/solr/collection/update?commit=true' -d '[{"id" : “12345”,”code” : {"set" : “500”}}]’
{
  "responseHeader":{
    "rf":1,
    "status":0,
    "QTime":11}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM