kiran created SOLR-8607:
---------------------------
Summary: In Managed schema mode, Schema API throws error when
adding new fields if the all catch dynamic field is defined
Key: SOLR-8607
URL: https://issues.apache.org/jira/browse/SOLR-8607
Project: Solr
Issue Type: Bug
Components: Data-driven Schema
Affects Versions: 5.3.1
Reporter: kiran
Priority: Minor
If the all catch dynamic field '*' is present in a managed schema collection,
then any field creation requests through Schema API return the confusing/weird
error "Field $\{FIELD_NAME\} already exists".
*Schema of a test collection*:
{code}
curl -X GET http://localhost:8983/solr/testSQLQueries-eventsim/schema
{
"responseHeader":{
"status":0,
"QTime":0},
"schema":{
"name":"example",
"version":1.5,
"uniqueKey":"id",
"fieldTypes":[{
"name":"boolean",
"class":"solr.BoolField",
"sortMissingLast":true},
{
"name":"double",
"class":"solr.TrieDoubleField",
"positionIncrementGap":"0",
"precisionStep":"0"},
{
"name":"float",
"class":"solr.TrieFloatField",
"positionIncrementGap":"0",
"precisionStep":"0"},
{
"name":"int",
"class":"solr.TrieIntField",
"positionIncrementGap":"0",
"precisionStep":"0"},
{
"name":"long",
"class":"solr.TrieLongField",
"precisionStep":"6"},
{
"name":"string",
"class":"solr.StrField",
"sortMissingLast":true},
{
"name":"tdate",
"class":"solr.TrieDateField",
"positionIncrementGap":"0",
"precisionStep":"6"}],
"fields":[{
"name":"_root_",
"type":"string",
"indexed":true,
"stored":false},
{
"name":"_version_",
"type":"long",
"indexed":true,
"stored":true},
{
"name":"id",
"type":"string",
"indexed":true,
"required":true,
"stored":true}],
"dynamicFields":[{
"name":"*_tdt",
"type":"tdate",
"indexed":true,
"stored":true},
{
"name":"*_txt",
"type":"string",
"multiValued":true,
"indexed":true,
"stored":true},
{
"name":"*_ss",
"type":"string",
"multiValued":true,
"indexed":true,
"stored":true},
{
"name":"*_ii",
"type":"int",
"multiValued":true,
"indexed":true,
"stored":true},
{
"name":"*_ls",
"type":"long",
"multiValued":true,
"indexed":true,
"stored":true},
{
"name":"*_i",
"type":"int",
"indexed":true,
"stored":true},
{
"name":"*_s",
"type":"string",
"indexed":true,
"stored":true},
{
"name":"*_l",
"type":"long",
"indexed":true,
"stored":true},
{
"name":"*_b",
"type":"boolean",
"indexed":true,
"stored":true},
{
"name":"*_f",
"type":"float",
"indexed":true,
"stored":true},
{
"name":"*_d",
"type":"double",
"indexed":true,
"stored":true},
{
"name":"*",
"type":"string",
"indexed":true,
"stored":true}],
"copyFields":[]}}
{code}
*Create new field 'userId' using Schema API*
{code}
curl -X POST -H "Content-type:application/json" --data-binary '{"add-field":
{"name":"userId","type":"string","indexed":"true","stored":"true"}}'
http://localhost:8983/solr/testSQLQueries-eventsim/schema
{
"responseHeader":{
"status":0,
"QTime":6},
"errors":[{
"add-field":{
"name":"userId",
"type":"string",
"indexed":"true",
"stored":"true"},
"errorMessages":["Field 'userId' already exists.\n"]}]}
{code}
The field 'userId' does not exist in the schema but it is also not possible to
add this field because of the dynamic field '*'.
While one should never define dynamic field '*' in a managed schema, the Schema
API should atleast return some useful error message.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]