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 bbarani <bb...@gmail.com> on 2010/06/30 16:42:46 UTC

Is there a way to delete multiple documents using wildcard?

Hi,

I am trying to delete a group of documents using wildcard. Something like 

update?commit=true%20-H%20"Content-Type:%20text/xml"%20--data-binary%20'<delete><doc><field%20name="uid">6-HOST*</field></doc></delete>'

I want to delete all documents which contains the uid starting with 6-HOST
but this query doesnt seem to work.. Am I doing anything wrong??

Thanks,
BB
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-delete-multiple-documents-using-wildcard-tp933468p933468.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to delete multiple documents using wildcard?

Posted by Emir Arnautović <em...@sematext.com>.
Hi,
Delete by query should work - posting to /update

	<delete><query>*:*</query></delete>

should delete all doc.

HTH,
Emir

> On 21 Sep 2017, at 05:25, balmydrizzle <ba...@gmail.com> wrote:
> 
> Doesn't work, either. wildcard query can't be used in delete. At least for
> old Solr 3.x
> 
> 
> 
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Is there a way to delete multiple documents using wildcard?

Posted by balmydrizzle <ba...@gmail.com>.
Doesn't work, either. wildcard query can't be used in delete. At least for
old Solr 3.x



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Is there a way to delete multiple documents using wildcard?

Posted by Jan Høydahl / Cominvent <ja...@cominvent.com>.
Hmm, nice one - I was not aware of that trick.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Training in Europe - www.solrtraining.com

On 30. juni 2010, at 18.41, bbarani wrote:

> 
> Hi,
> 
> I was able to sucessfully delete multiple documents using the below URL
> 
> /update?stream.body=<delete><query>uid:6-HOST*</query></delete>
> 
> Thanks,
> BB
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-delete-multiple-documents-using-wildcard-tp933468p933799.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Is there a way to delete multiple documents using wildcard?

Posted by bbarani <bb...@gmail.com>.
Hi,

I was able to sucessfully delete multiple documents using the below URL

/update?stream.body=<delete><query>uid:6-HOST*</query></delete>

Thanks,
BB
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-delete-multiple-documents-using-wildcard-tp933468p933799.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to delete multiple documents using wildcard?

Posted by Jan Høydahl / Cominvent <ja...@cominvent.com>.
Hi,

You need to use HTTP POST in order to send those parameters I believe. Try with curl:

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary "<delete><query>uid:6-HOST*</query></delete>"

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Training in Europe - www.solrtraining.com

On 30. juni 2010, at 17.53, bbarani wrote:

> 
> Yeah, I am getting the results when I use /select handler.
> 
> I tried the below query..
> 
> /select?q=uid:6-HOST*
> 
> Got <result name="response" numFound="52920" start="0">
> 
> Thanks
> BB
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-delete-multiple-documents-using-wildcard-tp933468p933697.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Is there a way to delete multiple documents using wildcard?

Posted by Sascha Szott <sz...@zib.de>.
Hi,

take a look inside Solr's log file. Are there any error messages with 
respect to the update request?

Furthermore, you could try the following two commands instead:

curl "http://host:port/solr/update" --form-string 
stream.body="<delete><query>uid:6-HOST*</query></delete>"

curl "http://host:port/solr/update" --form-string stream.body="<commit/>"

-Sascha

bbarani wrote:
>
> Yeah, I am getting the results when I use /select handler.
>
> I tried the below query..
>
> /select?q=uid:6-HOST*
>
> Got<result name="response" numFound="52920" start="0">
>
> Thanks
> BB

Re: Is there a way to delete multiple documents using wildcard?

Posted by bbarani <bb...@gmail.com>.
Yeah, I am getting the results when I use /select handler.

I tried the below query..

/select?q=uid:6-HOST*

Got <result name="response" numFound="52920" start="0">

Thanks
BB
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-delete-multiple-documents-using-wildcard-tp933468p933697.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to delete multiple documents using wildcard?

Posted by Sascha Szott <sz...@zib.de>.
Hi,

does /select?q=uid:6-HOST* return any documents?

-Sascha

bbarani wrote:
>
> Hi,
>
> Thanks a lot for your reply..
>
> I tried the below query
>
> update?commit=true%20-H%20"Content-Type:%20text/xml"%20--data-binary%20'<delete><query>uid:6-HOST*</query></delete>'
>
> But even now none of the documents are getting deleted.. Am I forming the
> URL wrong?
>
> Thanks,
> BB

Re: Is there a way to delete multiple documents using wildcard?

Posted by bbarani <bb...@gmail.com>.
Hi,

Thanks a lot for your reply..

I tried the below query

update?commit=true%20-H%20"Content-Type:%20text/xml"%20--data-binary%20'<delete><query>uid:6-HOST*</query></delete>'

But even now none of the documents are getting deleted.. Am I forming the
URL wrong?

Thanks,
BB
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-delete-multiple-documents-using-wildcard-tp933468p933585.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to delete multiple documents using wildcard?

Posted by Sascha Szott <sz...@zib.de>.
Hi,

you can delete all docs that match a certain query:

<delete><query>uid:6-HOST*</query></delete>

-Sascha

bbarani wrote:
>
> Hi,
>
> I am trying to delete a group of documents using wildcard. Something like
>
> update?commit=true%20-H%20"Content-Type:%20text/xml"%20--data-binary%20'<delete><doc><field%20name="uid">6-HOST*</field></doc></delete>'
>
> I want to delete all documents which contains the uid starting with 6-HOST
> but this query doesnt seem to work.. Am I doing anything wrong??
>
> Thanks,
> BB