You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2013/07/10 16:13:54 UTC
[Solr Wiki] Update of "SchemaRESTAPI" by SteveRowe
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "SchemaRESTAPI" page has been changed by SteveRowe:
https://wiki.apache.org/solr/SchemaRESTAPI?action=diff&rev1=13&rev2=14
Comment:
Restructure the schema modification section
=== Query params ===
- || '''param''' || '''description''' ||
+ || '''param''' || '''description''' ||
- || showDefaults || include in the response all default property values from the associated field type, e.g. {{{tokenized}}} for {{{solr.TextField}}} ||
+ || showDefaults || include in the response all default property values from the associated field type, e.g. {{{tokenized}}} for {{{solr.TextField}}} ||
|| includeDynamic || if the "fl" param is specified, matching dynamic fields are included in the response and identified with the {{{dynamicBase}}} property; if the "fl" param is not specified, the "includeDynamic" query param is ignored ||
- || fl || restricts returned results to the value of this param, which can either be a single field or a comma- or space-separated list of fields ||
+ || fl || restricts returned results to the value of this param, which can either be a single field or a comma- or space-separated list of fields ||
- || source.fl || copyField source field list - see the "fl" param description ||
+ || source.fl || copyField source field list - see the "fl" param description ||
- || dest.fl || copyField destination field list - see the "fl" param description ||
+ || dest.fl || copyField destination field list - see the "fl" param description ||
See CoreQueryParameters and CommonQueryParameters for descriptions of params not in the above table.
- == Adding fields to a schema ==
+ == Modifying the schema ==
<!> Solr 4.4
+ === Supported operations ===
+
- Fields may be added to a schema if the field name(s) are not already in the schema, and if the field name(s) don't match any dynamicFields.
+ * Add field(s): Fields may be added to the schema if the field name(s) are not already in the schema, and if the field name(s) don't match any dynamicFields.
+ * Specify Copy Field(s): !Copy Field directives may be added to the schema if both the source and all destination fields already exist in the schema. You can specify copyFields either as part of an add field(s) operation via a PUT or POST to {{{schema/fields}}}, or as an independent operation via a POST to {{{schema/copyfields}}}. See [[https://issues.apache.org/jira/browse/SOLR-5010|SOLR-5010]] for more information.
+
+ === Required: Managed mutable schema ===
In order to enable schema modifications via the Schema REST API, the schema implementation must be declared as '''managed''' by Solr, that is, not to be manually edited. See [[https://issues.apache.org/jira/browse/SOLR-4658|SOLR-4658]] for more information.
@@ -64, +69 @@
The first time you load a core with the above declaration in the corresponding {{{solrconfig.xml}}}, it will convert the existing schema to '''managed''' format, persist the result to the resource you name in the configuration, and rename the original schema file by appending {{{.bak}}} to its name, e.g. {{{schema.xml}}} will be renamed to {{{schema.xml.bak}}}.
- <!> NOTE <!> Converting a SolrCloud configset's schema to managed, and adding fields to the schema, will affect all other collections that use the same configset.
+ <!> NOTE <!> Converting a SolrCloud configset's schema to managed, and modifying the schema, will affect all other collections that use the same configset.
- Supported requests - note that at present, only JSON is supported for the body of these requests:
+ === Supported requests ===
+ Note that at present, only JSON format is supported for the body of these requests:
- || '''Operation''' || '''HTTP method''' || '''Example URL''' || '''Example Body''' || '''Supported query params''' || '''Default params''' ||
- ||||||||<bgcolor="#F6F6FF"> '''All requests''' ||<bgcolor="#F6F6FF"> '''wt, indent''' ||<bgcolor="#F6F6FF"> '''?wt=json&indent=on''' ||
- || Add Multiple Fields || POST || [[http://localhost:8983/solr/schema/fields]] || {{{[{"name":"newfield1","type":"text","stored":"false","copyFields":["target1,...]},}}}<<BR>> {{{{"name":"newfield2","type":"text","stored":"false"}]}}} || || ||
- || Add a Single Field || PUT || [[http://localhost:8983/solr/schema/fields/]]''newfield'' || {{{{"type":"text","stored":"false","copyFields":["target1",...]} }}} || || ||
- || Specify 1 or more Copy Fields || POST || [[http://localhost:8983/solr/schema/copyfields]] || {{{[{"source":"sourceField","dest":["target1",...]}, ...] }}} ||
- <!> Solr 4.4: The ability to specify copy fields is available in Solr 4.4 and beyond. See SOLR-5010 in JIRA.
- <!> NOTE <!> The copy field targets/destinations must exist before they can appear in either the "copyFields" parameter or the "dest" parameter.
+ || '''Operation''' || '''HTTP method''' || '''Example URL''' || '''Example Body''' || '''Supported query params''' || '''Default params''' ||
+ ||||||||<bgcolor="#F6F6FF"> '''All requests''' ||<bgcolor="#F6F6FF"> '''wt, indent''' ||<bgcolor="#F6F6FF"> '''?wt=json&indent=on''' ||
+ ||<(|2> Add Field(s) || PUT || [[http://localhost:8983/solr/schema/fields/]]''newfield'' || {{{{"type":"text","stored":"false","copyFields":["target1",...]} }}} || || ||
+ || POST || [[http://localhost:8983/solr/schema/fields]] || {{{[{"name":"newfield1","type":"text","copyFields":["target1",...]},}}}<<BR>> {{{{"name":"newfield2","type":"text","stored":"false"}]}}} || || ||
+ || Specify Copy Field(s) || POST || [[http://localhost:8983/solr/schema/copyfields]] || {{{[{"source":"sourceField","dest":["target1",...]}, ...] }}} || || ||