#su-solr-c"/usr/local/solr/solr/bin/solrcreate-cgettingstarted-ndata_driven_schema_configs"In this command, gettingstarted is the set name, and-n specifies the configuration set. Solr provides three configuration sets by default. Here we use schemaless, which means that any column with any name can be provided, and the type will be guessed.
Setupnewcoreinstancedirectory:/data/solr/data/gettingstartedCreatingnewcore'gettingstarted'usingcommand:http://localhost:8983/solr/admin/cores?action=CREATE&name=gettingstarted&instanceDir=gettingstarted{"responseHeader":{"status":0,"QTime":3247},"core":"gettingstarted"}
You have created a collection and can add data. The default architecture only needs to provide one column: id. No other default columns, only dynamic columns.
Add and query documents
In this section, we will browse the Solr Web interface and add some documents to the collection.
If you access http: // your_server_ip: 8983/solr using a Web browser, the Solr Web interface will be displayed:
This Web Interface contains a large amount of useful information and can be used to debug any problems arising during use.
The set is divided into cores, which is why there are a lot of references to the core in the Web interface. Currently, gettingstarted only contains one core, named gettingstarted. On the left side, you can see the "Core Selector" drop-down menu. You can select gettingstarted to view more information.
After selecting the gettingstarted core, select "events ". Files store real data that can be searched by Solr. Because we use a stateless configuration, we can use any column. I added a single document using the following JSON example and copied the following to the "Documents (s)" column:
{"number":1,"president":"GeorgeWashington","birth_year":1732,"death_year":1799,"took_office":"1789-04-30","left_office":"1797-03-04","party":"NoParty"}Click "Submit document" to add the document to the index. After a while, you will see the following information:
Output after adding a document:
Status:successResponse:{"responseHeader":{"status":0,"QTime":290}}You can use a similar or totally different structure to add more documents, but you can also use only one document to continue.
Now, select "Query" on the left to Query the document we just added. Keep the default value on the screen. After you click "Execute Query", you can view up to 10 documents, depending on how much you have added:
Query output
{"responseHeader":{"status":0,"QTime":39,"params":{"q":"*:*","indent":"true","wt":"json","_":"1442371884598"}},"response":{"numFound":1,"start":0,"docs":[{"number":[1],"president":["GeorgeWashington"],"birth_year":[1732],"death_year":[1799],"took_office":["1789-04-30T00:00:00Z"],"left_office":["1797-03-04T00:00:00Z"],"party":["NoParty"],"id":"b9b294c1-4b68-4d96-adc2-f6fb77f60932","_version_":1512437472611532800}]}}
Reference: http://lucene.apache.org/solr/quickstart.html