You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Wilson, Robert" <rw...@constantcontact.com> on 2011/01/13 01:38:02 UTC

Question on deleting all rows for an index

We are just staring with Solr and have a multi core implementation and need to delete all the rows in the index to clean things up.

When running an update via a url we are using something like the following which works fine:
http://localhost:8983/solr/template/update/csv?commit=true&escape=\&stream.file=/opt/TEMPLATE_DATA.csv

Not clear on how to delete all the rows in this index. The documentation gives this example:
<delete><query>timestamp:[* TO NOW-12HOUR]</query></delete>

I'm not clear on the context of this command - is this through the Solr admin or can you run this via the restful call?

Trying to add this to a restful call does not work like this attempt:
http://localhost:8983/solr/template/<delete><query>timestamp:[* TO NOW-12HOUR]</query></delete>

Any thoughts appreciated.

Bob


Re: Question on deleting all rows for an index

Posted by Gora Mohanty <go...@mimirtech.com>.
On Thu, Jan 13, 2011 at 6:08 AM, Wilson, Robert
<rw...@constantcontact.com> wrote:
> We are just staring with Solr and have a multi core implementation and need to delete all the rows in the index to clean things up.
>
> When running an update via a url we are using something like the following which works fine:
> http://localhost:8983/solr/template/update/csv?commit=true&escape=\&stream.file=/opt/TEMPLATE_DATA.csv
>
> Not clear on how to delete all the rows in this index. The documentation gives this example:
> <delete><query>timestamp:[* TO NOW-12HOUR]</query></delete>
[...]

Not sure where you got that from. The proper delete query to delete
*all* records would be:
<delete><query>*:*</query></delete>

Please note that you have to follow the delete with a commit. You
can use curl to call Solr for both the delete and commit. Please see
http://wiki.apache.org/solr/UpdateXmlMessages for details.

Regards,
Gora

Re: Question on deleting all rows for an index

Posted by "Grijesh.singh" <pi...@gmail.com>.
Use this type of url for delete all data with fallowed by commit
http://localhost:8983/solr/update/?stream.body=<delete><query>*:*</query></delete>&commit=true 

-----
Grijesh
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Question-on-deleting-all-rows-for-an-index-tp2246726p2246948.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Question on deleting all rows for an index

Posted by Daniel Ostermeier <da...@gmail.com>.
Hi Robert,

You can find an example of something similar to this in the examples 
that are part of the solr distribution.  The tutorial ( 
http://lucene.apache.org/solr/tutorial.html) describes how to post data 
to the solr server via the post.jar

user:~/solr/example/exampledocs$ *java -jar post.jar solr.xml monitor.xml*

If you take a look at the solr.xml file, you will see

<add>
<doc>
<field name="id">SOLR1000</field>
<field name="name">Solr, the Enterprise Search Server</field>
</doc>
</add>

I think you can post your delete query to the server in the same way.

Hope this helps.

-Daniel


> We are just staring with Solr and have a multi core implementation and need to delete all the rows in the index to clean things up.
>
> When running an update via a url we are using something like the following which works fine:
> http://localhost:8983/solr/template/update/csv?commit=true&escape=\&stream.file=/opt/TEMPLATE_DATA.csv
>
> Not clear on how to delete all the rows in this index. The documentation gives this example:
> <delete><query>timestamp:[* TO NOW-12HOUR]</query></delete>
>
> I'm not clear on the context of this command - is this through the Solr admin or can you run this via the restful call?
>
> Trying to add this to a restful call does not work like this attempt:
> http://localhost:8983/solr/template/<delete><query>timestamp:[* TO NOW-12HOUR]</query></delete>
>
> Any thoughts appreciated.
>
> Bob
>
>
>    


Re: Question on deleting all rows for an index

Posted by kenf_nc <ke...@realestate.com>.
If this is a one-time cleanup, not something you need to do programmatically,
you could delete the index directory ( <solrDir>/data/index ). In my case I
have to stop Tomcat, delete .\index and restart Tomcat. It is very fast and
starts me out with a fresh, empty, index. Noticed you are multi-core, I'm
not, so this could be bogus information for you...but thought I'd toss it
out just in case.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Question-on-deleting-all-rows-for-an-index-tp2246726p2248332.html
Sent from the Solr - User mailing list archive at Nabble.com.