use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class ElasticsearchBackendSearchTypesWithStreamsOverridesTest method queryWithMixedPresenceOfOverridesIncludesMultipleSetsOfIndices.
@Test
public void queryWithMixedPresenceOfOverridesIncludesMultipleSetsOfIndices() throws IOException {
final Query query = queryFor(Pivot.builder().id("pivot1").series(Collections.singletonList(Average.builder().field("field1").build())).rollup(true).streams(Collections.singleton(stream2Id)).build(), Pivot.builder().id("pivot2").series(Collections.singletonList(Max.builder().field("field2").build())).rollup(true).streams(Collections.emptySet()).build());
final List<SearchRequest> request = run(query);
assertThat(indicesOf(request).get(0)).isEqualTo("index3");
assertThat(indicesOf(request).get(1)).isEqualTo("index1,index2");
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class ClientES7 method putSetting.
@Override
public void putSetting(String setting, String value) {
final ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
request.persistentSettings(Settings.builder().put(setting, value));
client.execute((c, requestOptions) -> c.cluster().putSettings(request, requestOptions), "Unable to update ES cluster setting: " + setting + "=" + value);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class ClientES7 method existingIndices.
private String[] existingIndices() {
final Request request = new Request("GET", "/_cat/indices");
request.addParameter("format", "json");
request.addParameter("h", "index");
final JsonNode jsonResponse = client.execute((c, requestOptions) -> {
request.setOptions(requestOptions);
final Response response = c.getLowLevelClient().performRequest(request);
return objectMapper.readTree(response.getEntity().getContent());
});
return Streams.stream(jsonResponse.elements()).map(index -> index.path("index").asText()).distinct().toArray(String[]::new);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class ClientES7 method getMapping.
private Map<String, String> getMapping(String index) {
final Request request = new Request("GET", "/" + index + "/_mapping");
final JsonNode response = client.execute((c, requestOptions) -> {
request.setOptions(requestOptions);
final Response result = c.getLowLevelClient().performRequest(request);
return objectMapper.readTree(result.getEntity().getContent());
});
return extractFieldMappings(index, response).collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().path("type").asText()));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project datashare by ICIJ.
the class ElasticsearchConfigurationTest method test_create_client_creates_settings.
@Test
public void test_create_client_creates_settings() throws Exception {
ElasticsearchConfiguration.createESClient(new PropertiesProvider());
Response response = es.client.getLowLevelClient().performRequest(new Request("GET", TEST_INDEX));
assertThat(EntityUtils.toString(response.getEntity())).contains("settings");
}
Aggregations