Description
Successful, correct:
{ "create-alias" : { "name": "testalias1", "collections":["collection1"] } }
Successful, but wrong:
{ "create-alias" : { "name": "testalias1", "collections":["collection1,collection2"] } }
Fails, but should work based on details in _introspect:
{ "create-alias" : { "name": "testalias2", "collections":["collection1","collection2"] } }
The error returned is:
{ "responseHeader": { "status": 400, "QTime": 25 }, "Operation createalias caused exception:": "org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Can't create collection alias for collections='[collection1, collection2]', '[collection1' is not an existing collection or alias", "exception": { "msg": "Can't create collection alias for collections='[collection1, collection2]', '[collection1' is not an existing collection or alias", "rspCode": 400 }, "error": { "metadata": [ "error-class", "org.apache.solr.common.SolrException", "root-error-class", "org.apache.solr.common.SolrException" ], "msg": "Can't create collection alias for collections='[collection1, collection2]', '[collection1' is not an existing collection or alias", "code": 400 } }
whereas
GET localhost:8981/api/c
yields
{ "responseHeader": { "status": 0, "QTime": 0 }, "collections": [ "collection2", "collection1" ] }
Intropsection shows:
"collections": { "type": "array", "description": "The list of collections to be known as this alias.", "items": { "type": "string" } },
Basically the property is documented as an array, but parsed as a string (I suspect it's parsed as a list but then the toString value of the list is used, but haven't checked). We have a conflict between what is natural for expressing a list in JSON (an array) and what is natural for expressing a list as a parameter (comma separation). I'm unsure how best to resolve this, as it's a question of making "direct translation" to v2 work vs making v2 more natural. I tend to favor accepting an array and therefore making v2 more natural which would be more work, but want to know what others think. From a back compatibility perspective, that direction also makes this clearly a bug fix rather than a breaking change since it doesn't match the _introspect documentation. I also haven't tried looking at old versions to find any evidence as to whether the documented form worked previously... so I don't know if this is a regression or if it never worked.
Attachments
Attachments
Issue Links
- relates to
-
SOLR-11617 Expose Alias Properties CRUD in REST API
- Closed