Search in sources :

Example 1 with GetIndexTemplatesResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesResponse in project graylog2-server by Graylog2.

the class ClientES7 method templateExists.

@Override
public boolean templateExists(String templateName) {
    final GetIndexTemplatesRequest request = new GetIndexTemplatesRequest("*");
    final GetIndexTemplatesResponse result = client.execute((c, requestOptions) -> c.indices().getIndexTemplate(request, requestOptions));
    return result.getIndexTemplates().stream().anyMatch(indexTemplate -> indexTemplate.name().equals(templateName));
}
Also used : GetIndexTemplatesResponse(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesResponse) GetIndexTemplatesRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesRequest)

Example 2 with GetIndexTemplatesResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesResponse 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);
}
Also used : GetIndexTemplatesResponse(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesResponse) GetIndexTemplatesRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesRequest)

Aggregations

GetIndexTemplatesRequest (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesRequest)2 GetIndexTemplatesResponse (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.GetIndexTemplatesResponse)2