Create Core & Add Data in Solr

Install solr first Introduction

  1. Now config solr setup:

sudo chmod -R u+w /var/solr/data
  1. Create core data:

sudo su - solr -c "/opt/solr/bin/solr create -c coder -n data_driven_schema_configs" 
  1. To delete core data:

/opt/solr/bin/solr delete -c coder

Then, create the solr core again:

In case, you got any error check on the logs:

cd /var/solr

Try to give 755 permission if you stuck for permission there.

For restart:

sudo service solr restart

POST request to the Solr server running on 127.0.0.1:8983 with the content type set to JSON

  • Solr core name: coder

curl -X POST \
  -H 'Content-Type: application/json' \
  'http://127.0.0.1:8983/solr/coder/update/json/docs' \
  --data-binary '{
    "id": "02",
    "first_name": "Abishek",
    "last_name": "Kafle",
    "title": "DevOps and Security",
    "cybername": "anoint"
  }'
sudo service solr restart

Last updated