【问题标题】:how to update User-Defined Properties in core.properties on solr collections如何在 solr 集合上更新 core.properties 中的用户定义属性
【发布时间】:2020-05-14 11:28:34
【问题描述】:

我们正在使用 solr cloud 7.7.2,并且所有产品都可以正常工作。下面是我们用来创建集合的简化 curl 语句:

curl -X POST -H 'Content-type: application/json' -d '{"create": {"name": "organization-3.0.0", "config": "organization-3.0.0-cfg", "numShards": "1", "replicationFactor": "3", "maxShardsPerNode": "1", 
  "properties": {
    "solr": { 
      "db": {
        "driver": "com.mysql.jdbc.Driver" 
      }
    } 
  }
}}' http://192.168.0.10:8983/api/collections

灵感来自https://lucene.apache.org/solr/guide/7_7/configuring-solrconfig-xml.html#user-defined-properties-in-core-properties

如您所见,我们有一个 json 作为“properties”属性的值。通过这样做,属性最终被添加到 core.properties(在每个分片中),我们使用这些属性通过 DIH 执行数据导入。

当我们想要更新“properties”属性的值时,我们实际上以新名称创建了一个新集合,例如:organization-3.0.1,并通过 DIH 重新导入所有数据(这可能需要很长时间)。

我们希望能够真正更新现有集合的“属性”属性的值。

我在文档https://lucene.apache.org/solr/guide/7_7/collections-api.html#modifycollection中看不到“properties”属性是有效属性

所以我想知道是否有任何方法可以修改 solr 集合上的“属性”属性?

【问题讨论】:

    标签: curl solr solrcloud


    【解决方案1】:

    有 - 你的问题是它是在 Solr 7.3 中引入的 - 你激活的版本之后的版本。我建议升级到更新的版本 - 一直到 8.5.x(升级应该更容易,因为它只是它们之间的一个主要版本)。

    COLLECTIONPROP

    添加、编辑或删除集合属性。

    /admin/collections?action=COLLECTIONPROP&name=collectionName&propertyName=propertyName&propertyValue=propertyValue

    【讨论】:

    • thx @matslindh,抱歉我打错了,我们使用的是 7.7.2。我尝试运行 curl "http://192.168.0.10:8983/solr/admin/collections?action=COLLECTIONPROP&name=organization-3.0.0&propertyName=testprop&propertyValue=testvalue01&wt=xml" 并希望看到添加到 core.properties 旁边 solr.db.driver=com.mysql.jdbc.Driver 旁边的道具知道我的错误或误解是什么吗?
    • COLLECTIONPROP 的调用有何反应?您如何查找属性值?
    • <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">1</int> </lst> </response> 我期待该属性被插入到位于solr/organization-3.0.0_shard1_replica_n2的生成的core.properties中
    • 我不确定它是在那里可见还是只是作为配置覆盖存储在 Zookeeper 中。
    猜你喜欢
    • 1970-01-01
    • 2023-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多