You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

设置update.autoCreateFields为false在Solr中不生效问题求助

Solr禁用自动字段创建后仍自动生成字段

操作流程

  • 执行命令禁用字段自动创建:
    curl -X POST http://localhost:8984/solr/products/config -H 'Content-Type: application/json' -d '{
    "set-user-property": {
      "update.autoCreateFields": "false"
    }}'
    
  • 确认configoverlay.json中已配置{"userProps":{"update.autoCreateFields":"false"}}
  • 重载集合:
    curl -X POST http://localhost:8984/api/collections/products/reload
    
  • 提交含未知字段的文档进行索引:
    curl http://localhost:8984/solr/products/update/json?commit=true -H "Content-Type: application/json" -d '[{"id":"123", "unknown": "fail me"}]'
    

异常情况

文档无错误完成索引,Solr自动创建了类型为text_general的unknown字段和类型为string的unknown_str字段,与预期不符——预期因unknown字段不存在于schema中,文档无法被索引。

环境说明

  • Docker部署Solr 9.8.0
  • 采用SolrCloud模式,单节点搭配嵌入式ZooKeeper

补充测试结果

测试多个与schema或动态字段均不匹配的字段(如携带日期值的xyx字段),结果仍能被索引,且Solr自动创建了类型为pdate的对应字段。

集合创建命令

curl -X POST http://localhost:8984/api/collections -H 'Content-Type: application/json' -d
 '{
    "name": "products",
    "numShards": 1,
    "replicationFactor": 1
  }'

内容的提问来源于stack exchange,提问作者BenA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 17:28:24