use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class ClientES7 method refreshNode.
@Override
public void refreshNode() {
final RefreshRequest refreshRequest = new RefreshRequest();
client.execute((c, requestOptions) -> c.indices().refresh(refreshRequest, requestOptions));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class ClientES7 method deleteTemplates.
@Override
public void deleteTemplates(String... templates) {
for (String template : templates) {
final DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(template);
client.execute((c, requestOptions) -> c.indices().deleteTemplate(deleteIndexTemplateRequest, requestOptions));
}
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class ClientES7 method existingTemplates.
private String[] existingTemplates() {
final GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest();
final GetIndexTemplatesResponse result = client.execute((c, requestOptions) -> c.indices().getIndexTemplate(getIndexTemplatesRequest, requestOptions));
return result.getIndexTemplates().stream().map(IndexTemplateMetadata::name).toArray(String[]::new);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions 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.RequestOptions 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()));
}
Aggregations