Remove filters and filter subscriptions

We are planning to host a new JIRA instance for one of our teams and we configured that by cloning data from existing dump, cleaned the existing data, users, groups, projects etc. without changing the configuration schemes. As we have removed all the projects from this instance, is it safe to delete SEARCHREQUEST and FILTERNOTIFICATIONS tables for removing the existing filters and subscriptions? If not what is the best way to flush out 16000 filters from this instance.

3 answers

Deletion of the filters and subscriptions will need to be done at the database level. There is no other ways.


0 votes
Richie Gee Atlassian Team Aug 16, 2013

Run integrity checked, it should be deleting those is no long associated with anything.

Hope this helps :)

I had written a groovy script for deleting filters, subscriptions and users and it is working well. I searched the tables SEARCHREQUEST and FILTERNOTIFICATIONS and found no rows after the script gets executed.

if(!ldapInfo.isJiraAdmin(user.getName(), user.getDisplayName()) ){
			boolean hasSubscriptions = false;
			Collection<SearchRequest> filters = searchRequestService.getOwnedFilters(user);"Removing User ID: "+user.getName()+" NAME: "+user.getDisplayName()+" Directory ID: "+user.getDirectoryId());
			if(filters != null && filters.size() >0){
				filtersCount = filtersCount + filters.size();
				Iterator<SearchRequest> srIterator = filters.iterator();
					SearchRequest searchRequest =;
					List<GenericValue> subscriptions = subscriptionManager.getAllSubscriptions(searchRequest.getId());
					if(subscriptions != null && subscriptions.size() >0){
						hasSubscriptions = true;"Total Filters: "+filters.size()+" Filter Id: "+searchRequest.getId()+" Subscriptions : "+subscriptions.size());					}
					try {
					} catch (Exception e) {
					log.error("Exception while removing Subscriptions for user: "+user.getDisplayName());
				searchRequestService.deleteAllFiltersForUser(jsc, user);
			userUtil.removeUser(ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser(), user);"Removed subscriptions, filters and user...");

I don't think it picks up filters which aren't associated with a project. For example if you create project 'test' and have a filter 'filter1' which is the query project = "TEST" if you delete the project 'test' it will not delete the filter. Running integrity check will also not delete or even detect the filter.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,741 views 17 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you