Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16678

Collection API v2 CREATE does not handle user-defined properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 9.1
    • main (10.0), 9.3
    • v2 API
    • None

    Description

      According to this documentation https://solr.apache.org/guide/solr/latest/configuration-guide/property-substitution.html, we should be able with the Collection API v2 CREATE, to define custom core properties and use them in the solrconfig.xml file

      This is not working properly as, for example, if I try to define a "lib.path" property that I use in the solrconfig.xml of my collection, I get the following error:

      curl -XPOST http://localhost:8983/api/collections -H 'Content-Type: application/json' -d '{"create": {"name": "MyCollection", "config": "Init", "numShards": 2, "replicationFactor":1, "property.lib.path":"/my/lib/path"}}' 
      
      {
        "responseHeader":{
          "status":400,
          "QTime":738},
        "failure":{
          "127.0.0.1:8983_solr":"org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException:Error from server at null: Error CREATEing SolrCore 'MyCollection_shard1_replica_n3': Unable to create core [MyCollection_shard1_replica_n3] Caused by: No system property or default value specified for lib.path value:${lib.path}/Custom",
          "127.0.0.1:8983_solr":"org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException:Error from server at null: Error CREATEing SolrCore 'MyCollection_shard2_replica_n1': Unable to create core [MyCollection_shard2_replica_n1] Caused by: No system property or default value specified for lib.path value:${lib.path}/Custom"},
        "Operation create caused exception:":"org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Underlying core creation failed while creating collection: MyCollection",
        "exception":{
          "msg":"Underlying core creation failed while creating collection: MyCollection",
          "rspCode":400},
        "error":{
          "metadata":[
            "error-class","org.apache.solr.common.SolrException",
            "root-error-class","org.apache.solr.common.SolrException"],
          "msg":"Underlying core creation failed while creating collection: MyCollection",
          "code":400}}

        

      Doing the same with the Collection API v1 properly works:

      curl -XGET "http://localhost:8983/solr/admin/collections?action=CREATE&name=MyCollection&collection.configName=Init&numShards=2&maxShardsPerNode=2&replicationFactor=1&property.lib.path=/my/lib/path"
      
      {
        "responseHeader":{
          "status":0,
          "QTime":1419},
        "success":{
          "127.0.0.1:8983_solr":{
            "responseHeader":{
              "status":0,
              "QTime":1062},
            "core":"MyCollection_shard1_replica_n3"},
          "127.0.0.1:8983_solr":{
            "responseHeader":{
              "status":0,
              "QTime":1062},
            "core":"MyCollection_shard2_replica_n1"}}} 

      Attachments

        Issue Links

          Activity

            People

              gerlowskija Jason Gerlowski
              julienFL Julien Massiera
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m