I have a big index, and during the indexation process there was an error. So to avoid reindexing which takes several days, I want to simply delete specific field and reindex. Is there any suggestion?
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.
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:
curl http://localhost:8983/solr/update?commit=true -H 'Content-type:application/json' --data-binary '[{"id": "630911fa-711a-3944-b1d2-cda6857f9827", "field_to_be_removed": {"set": null}}]'
you can do this if your rest of the fields are stored i.e stored="true "
.as follows by setting null value.
<add>
<doc>
<!-- your unique key field -->
<field name="employeeId">05991</field>
<!-- what ever field you want to delete -->
<field name="skills" update="set" null="true" />
</doc>
</add>
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.
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.
You can delete all the index using the command delete and a query like this:
java -Ddata=args -Dcommit=yes -jar post.jar "<delete><query>*:*</query></delete>"
Using the argument -Dcommit
force to update the index, so, be careful not deleting all documents when you dont want.
With solr 8.11.2,
curl 'http://localhost:8983/solr/solr/schema' -d '{"delete-field":{"name":"${field_name}"}}'
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.
© 2022 - 2024 — McMap. All rights reserved.