solrsolr8

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

Solution

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