11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Add a Dynamic Field Rule<br />

The add-dynamic-field command adds a new dynamic field rule to your schema.<br />

All of the properties available when editing schema.xml can be passed with the POST request. The section Dyn<br />

amic Fields has details on all of the attributes that can be defined for a dynamic field rule.<br />

For example, to create a new dynamic field rule where all incoming fields ending with "_s" would be stored and<br />

have field type "string", you can POST a request like this:<br />

curl -X POST -H 'Content-type:application/json' --data-binary '{<br />

"add-dynamic-field":{<br />

"name":"*_s",<br />

"type":"string",<br />

"stored":true }<br />

}' http://localhost:8983/solr/gettingstarted/schema<br />

Delete a Dynamic Field Rule<br />

The delete-dynamic-field command deletes a dynamic field rule from your schema. If the dynamic field<br />

rule does not exist in the schema, or if the schema contains a copy field rule with a target or destination that<br />

matches only this dynamic field rule, an error is thrown.<br />

For example, to delete a dynamic field rule matching "*_s", you can POST a request like this:<br />

curl -X POST -H 'Content-type:application/json' --data-binary '{<br />

"delete-dynamic-field":{ "name":"*_s" }<br />

}' http://localhost:8983/solr/gettingstarted/schema<br />

Replace a Dynamic Field Rule<br />

The replace-dynamic-field command replaces a dynamic field rule in your schema. Note that you must<br />

supply the full definition for a dynamic field rule - this command will not partially modify a dynamic field rule's<br />

definition. If the dynamic field rule does not exist in the schema an error is thrown.<br />

All of the properties available when editing schema.xml can be passed with the POST request. The section Dyn<br />

amic Fields has details on all of the attributes that can be defined for a dynamic field rule.<br />

For example, to replace the definition of the "*_s" dynamic field rule with one where the field type is<br />

"text_general" and it's not stored, you can POST a request like this:<br />

curl -X POST -H 'Content-type:application/json' --data-binary '{<br />

"replace-dynamic-field":{<br />

"name":"*_s",<br />

"type":"text_general",<br />

"stored":false }<br />

}' http://localhost:8983/solr/gettingstarted/schema<br />

Add a New Field Type<br />

The add-field-type command adds a new field type to your schema.<br />

All of the field type properties available when editing schema.xml by hand are available for use in a POST<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

75

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!