public Boolean terminate(final QueryKey queryKey) {
        if (LOGGER.isDebugEnabled()) {
            String json = JsonUtil.writeValueAsString(queryKey);
            LOGGER.debug("/terminate called with queryKey:\n{}", json);
        }

        final Supplier<Boolean> supplier = taskContextFactory.contextResult("Terminate search",
                taskContext -> {
                    taskContext.info(queryKey::getUuid);
                    LOGGER.debug(() -> "terminate called for queryKey " + queryKey);
                    final Optional<ResultStore> optionalResultStore = getIfPresent(queryKey);
                    if (optionalResultStore.isPresent()) {
                        final ResultStore resultStore = optionalResultStore.get();
                        checkPermissions(resultStore);
                        resultStore.terminate();
                        return true;
                    }
                    return false;
                });
        final Executor executor = executorProvider.get();
        final CompletableFuture<Boolean> completableFuture = CompletableFuture.supplyAsync(supplier, executor);
        try {
            return completableFuture.get();
        } catch (final InterruptedException | ExecutionException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
Terminate all running search processes associated with a result store.

@param queryKey The key of the result store to terminate searches on.
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/ResultStoreManager.java