@Test public void should_not_validate() throws Exception { ensureSearchable(THE_INDEX); ValidateQueryResponse response = httpClient .admin() .indices() .validateQuery(new ValidateQueryRequest(THE_INDEX).source("foo")) .get(); Assertions.assertThat(response.isValid()).isFalse(); }
@Test public void should_validate() throws Exception { ValidateQueryResponse response = httpClient .admin() .indices() .validateQuery( new ValidateQueryRequest(THE_INDEX) .source(new QuerySourceBuilder().setQuery(QueryBuilders.matchAllQuery()))) .get(); Assertions.assertThat(response.isValid()).isTrue(); }