solrschemadih

Solr: change managed schema to schema and add new field in WINDOWS when using DIH


I am trying to learn and create SOLR search engine for text search.

My initial step is to load a table of content from SQL to Solr. I have imported data using data import handler but Solr loaded only id field. Later I realised that the managed schema does not work with DIH. So I am currently switching form managed schema to classic schema.

One of the step that Solr learning material asks me to do is add new field through schema API and it has given below commands for UNIX. I am not sure its equivalent windows command. Since POST command cannot be used in windows.

curl -X POST -H 'Content-type:application/json' --data-binary '{
  "add-field":{
     "name":"sell-by",
     "type":"tdate",
     "stored":true 
  }
}' http://localhost:8983/solr/gettingstarted/schema

Below is the command I used which failed,

curl -X  java -jar example\exampledocs\post.jar  -H 'Content-type:application/json' --data-binary '{
  "add-field":{
    "name":"FIN", 
    "type":"int", 
      "stored":true 
  }
}' http://localhost:8983/solr/#/firstcore/schema

Your advice or help would be much appreciated. I am stuck here for long time. I could not find how to add fields in windows. Any advice would be very much appreciated.


Solution

  • There are some problem with your request parameter.

    These are the problem which I find from your provided data and here is my example of adding field.

    And Yes I am using Postman as a rest client

    Step to Use Postman to add new field in solr

    After success operation you will see you schema file of you collection will updated in Files menu on SOLR WebApp:

    To check that:

    SOLR WebApp menu