-
-
Save nz/673027 to your computer and use it in GitHub Desktop.
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F | |
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl | |
curl http://index.websolr.com/solr/a0b1c2d3/update -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>' |
You need "?commit=true" at end of url..
and ..
!/bin/sh
at top of file
@dynnamitt: The commit is indeed useful; this command assumes autoCommit
is set. Also, it's meant to be copied and pasted into a shell -- but by all means include the shebang and set u+x
for a standalone script :)
Very useful gist, thanks.
Fire this in the browser
For deletion:
http://host:port/solr/core/update?stream.body=:&commit=true
For schema reload:
http://host:port/solr/admin/cores?action=RELOAD&core=core
Replace
host: Host name
port: Port number
core: Core Name
Through curl :
curl http://host:port/solr/core_name/update?commit=true -H "Content-Type: text/xml" --data-binary `'<delete><query>*:*</query></delete>'`
Through browser :
http://host:port/solr/core_name/update?commit=true&stream.body=<delete><query>*:*</query></delete>
single core:
curl http://localhost:8080/solr/update?commit=true -H "Content-Type: text/xml" --data-binary ':'
multiple core:
curl http://localhost:8080/solr/core_name/update?commit=true -H "Content-Type: text/xml" --data-binary ':'
None of the commands above worked for me.
LE: http://localhost:8983/solr/core_name/update?commit=true&stream.body=%3Cdelete%3E%3Cquery%3E*%3A*%3C/query%3E%3C/delete%3E this worked 💃
The command by objectivePinta is shut off at least in Solr version 7.2.0 (in the out of the box configuration). However, the curl - solution of SainathSharmadha worked (for me) in this version.
Solr version 7.2.0 doesn't allow stream body anymore.
However, SainathSharmadha code will work by using binary data type.
If you're using the Post tool provided by solr:
bin/post -c core_name -type text/xml -out yes -d $'<delete><query>*:*</query></delete>'
Very useful --- thanks Nick!