Select/delete all items in Solr

1 min read >

Select/delete all items in Solr

Engineering Insights & Enterprise solutions

To select all items for a field in Solr you can use the query: some_item:[* TO *], but if this field is missing from some documents you will not select those documents.

To select all documents you can use the id defined in /conf/schema.xml, for example: <uniqueKey>solr_id</uniqueKey> you can use solr_id:[* TO *].

Now that you have all documents selected you can delete them 😀

To delete all documents in Solr use this update XML:

<delete><query>solr_id:[*TO *]</query></delete>

and of course, you have to commit:

<commit />

That’s all!

Unlock innovation and digital transformation for your business.

Get in touch

We are always happy to talk

Phone

+40-21-223-7700

Email

hello@tremend.com

Address

165 Splaiul Unirii, Timpuri Noi Square,
TN Office 2 building, 4th floor,
District 3, Bucharest, Romania, 030134