Update the value of a specific field in solr

50 Views Asked by At

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

There are 1 best solutions below

3
Abhijit Bashetti On BEST ANSWER

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