yl197837 发表于 2017-12-18 22:36:18

Apache Solr 学习入门 (一)

$ curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"id","type":"string","indexed":"true","stored":"true","required":"true","multiValued":"false"}}' http://192.168.2.122:8983/solr/solrbook/schema  {
  "responseHeader":{
  "status":0,
  "QTime":87},
  "errors":[{
  "add-field":{
  "name":"id",
  "type":"string",
  "indexed":"true",
  "stored":"true",
  "required":"true",
  "multiValued":"false"},
  "errorMessages":["Field 'id' already exists.\n"]}]}
$ curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"title","type":"text_ja","indexed":"true","stored":"true","required":"false","multiValued":"false"},"add-field":{"name":"sumamry","type":"text_ja","indexed":"true","stored":"true","required":"false","multiValued":"false"}}' http://192.168.2.122:8983/solr/solrbook/schema
  {
  "responseHeader":{
  "status":0,
  "QTime":633}}
$
$ vi managed-schema
$ curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"author","type":"string","indexed":"false","stored":"true","required":"false","multiValued":"true"},"add-field":{"name":"intended_reader","type":"string","indexed":"false","stored":"true","required":"false","multiValued":"true"},"add-field":{"name":"genre","type":"string","indexed":"false","stored":"true","required":"false","multiValued":"true"},"add-field":{"name":"isbn","type":"string","indexed":"false","stored":"true","required":"false","multiValued":"true"}}' http://192.168.2.122:8983/solr/solrbook/schema
  {
  "responseHeader":{
  "status":0,
  "QTime":488}}
$ curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"pub_date","type":"date","indexed":"true","stored":"true","required":"false","multiValued":"false"}}' http://192.168.2.122:8983/solr/solrbook/schema
  {
  "responseHeader":{
  "status":0,
  "QTime":267}}
$ curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name":"price","type":"tint","indexed":"true","stored":"true","required":"false","multiValued":"false"},"add-field":{"name":"pages","type":"tint","indexed":"false","stored":"true","required":"false","multiValued":"false"}}' http://192.168.2.122:8983/solr/solrbook/schema
  {
  "responseHeader":{
  "status":0,
  "QTime":242}}
页: [1]
查看完整版本: Apache Solr 学习入门 (一)