可以从 Solr 索引中的文档中删除字段吗?
我有一个很大的索引,在索引过程中出现了错误。因此,为了避免需要几天时间的重新索引,我想简单地删除特定字段并重新索引。有什么建议吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我有一个很大的索引,在索引过程中出现了错误。因此,为了避免需要几天时间的重新索引,我想简单地删除特定字段并重新索引。有什么建议吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
如果您使用 Solr 4,则可以使用 AtomicUpdate http://wiki.apache.org/solr/Atomic_Updates
更轻松地删除字段。例如:
If you're using Solr 4, you can use AtomicUpdate http://wiki.apache.org/solr/Atomic_Updates
to remove a field much more easily. For example:
如果您存储了其余字段,即
stored="true "
,则可以执行此操作。如下所示,通过设置 null 值。来源:https://wiki.apache.org/solr/UpdateXmlMessages
you can do this if your rest of the fields are stored i.e
stored="true "
.as follows by setting null value.source:https://wiki.apache.org/solr/UpdateXmlMessages
你不能。解决方案是获取文档,暂时存储在内存中,删除它,更新所需字段(删除、添加),然后将文档添加回索引。
You cannot. The solution would be to get the document, store temporarily in the memory, delete it, update the required field (remove, add) and then add the document back to the index.
您可以通过 id 删除索引文档。如果您想通过删除字段来更改架构,那么是的,您必须重新索引。
You can delete the indexed document by it's id. If you want to change the schema by removing a field, then yes, you would have to reindex.
您可以使用命令delete和如下查询来删除所有索引:
使用参数
-Dcommit
强制更新索引,因此,请小心不要在不需要时删除所有文档。You can delete all the index using the command delete and a query like this:
Using the argument
-Dcommit
force to update the index, so, be careful not deleting all documents when you dont want.使用 solr 8.11.2,
With solr 8.11.2,
您可以删除 Solr 中某个字段的索引值,但不能删除该字段。
如果您确实想在索引时删除特定字段,那么您应该在索引文档之前在 schema.xml 文件中配置该字段。
You can delete indexed value w.r.t. a field in Solr but not the field.
If you really want to delete a specific field while indexing then you should configure the field in schema.xml file before indexing document.