From 1b618c8e151534e994898a318cd291fa305ff98c Mon Sep 17 00:00:00 2001 From: temi Date: Mon, 2 Aug 2021 12:03:52 +1000 Subject: [PATCH] fixed deleting unreachable data --- grails-app/services/au/org/ala/profile/SearchService.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grails-app/services/au/org/ala/profile/SearchService.groovy b/grails-app/services/au/org/ala/profile/SearchService.groovy index 9745b57..865e0a9 100644 --- a/grails-app/services/au/org/ala/profile/SearchService.groovy +++ b/grails-app/services/au/org/ala/profile/SearchService.groovy @@ -856,13 +856,13 @@ class SearchService extends BaseDataAccessService { def jsonSlurper = new JsonSlurper() def query = jsonSlurper.parseText('{"query": {"match_all": {}}}') - def resp = webService.post(elasticSearchUrl + "/_search", query, [:], ContentType.APPLICATION_JSON, false, false, [:]) + def resp = webService.post(elasticSearchUrl + "/au.org.ala.profile/_search", query, [:], ContentType.APPLICATION_JSON, false, false, [:]) Integer total = resp?.resp?.hits?.total?: 0 if (total > 0) { // must add q:scientificName:* for deletion to make sure that it is only data that is deleted and not the index itself, i.e. au.org.ala.profile_v0 - webService.delete("${elasticSearchUrl}/${resp?.resp?.hits?.hits[0]._index}/profile/_query" , ['q':'scientificName:*'], ContentType.APPLICATION_JSON, false, false, [:]) + webService.post("${elasticSearchUrl}/${resp?.resp?.hits?.hits[0]._index}/profile/_delete_by_query" , null, ['q':'scientificName:*'], ContentType.APPLICATION_JSON, false, false, [:]) } ["RecordsDeleted": total] }