private void clearLookupCache(String viewUuid) { try { esClient.prepareClearCache() .setQueryCache(true) .get(); } catch (Exception e) { throw new IllegalStateException(String.format("Unable to clear lookup cache of view '%s'", viewUuid), e); } }
@Test public void get_with_string_timeout_is_not_yet_implemented() { try { es.client().prepareClearCache().get("1"); fail(); } catch (Exception e) { assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented"); } }
public void clearIndexes() { Loggers.get(getClass()).info("Truncate Elasticsearch indices"); try { esClient.prepareClearCache().get(); for (String index : esClient.prepareState().get().getState().getMetaData().getConcreteAllIndices()) { clearIndex(new IndexType(index, index)); } } catch (Exception e) { throw new IllegalStateException("Unable to clear indexes", e); } }
@Test public void get_with_time_value_timeout_is_not_yet_implemented() { try { es.client().prepareClearCache().get(TimeValue.timeValueMinutes(1)); fail(); } catch (Exception e) { assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented"); } }
@Test public void clear_cache() { ClearIndicesCacheRequestBuilder requestBuilder = es.client().prepareClearCache(); requestBuilder.get(); }
@Test public void trace_logs() { logTester.setLevel(LoggerLevel.TRACE); ClearIndicesCacheRequestBuilder requestBuilder = es.client().prepareClearCache(); requestBuilder.get(); assertThat(logTester.logs()).hasSize(1); }
@Test public void no_trace_logs() { logTester.setLevel(LoggerLevel.DEBUG); ClearIndicesCacheRequestBuilder requestBuilder = es.client().prepareClearCache(); requestBuilder.get(); assertThat(logTester.logs()).isEmpty(); }
private void clearLookupCache(String viewUuid) { try { esClient.prepareClearCache() .setQueryCache(true) .get(); } catch (Exception e) { throw new IllegalStateException(String.format("Unable to clear lookup cache of view '%s'", viewUuid), e); } }
public void clearIndexes() { Loggers.get(getClass()).info("Truncate Elasticsearch indices"); try { esClient.prepareClearCache().get(); for (String index : esClient.prepareState().get().getState().getMetaData().getConcreteAllIndices()) { clearIndex(new IndexType(index, index)); } } catch (Exception e) { throw new IllegalStateException("Unable to clear indexes", e); } }