use of org.graylog2.storage.SearchVersion in project graylog2-server by Graylog2.
the class IndexMappingTest method createsValidMappingTemplates.
@ParameterizedTest
@ValueSource(strings = { "5.0.0", "6.0.0", "7.0.0" })
void createsValidMappingTemplates(String versionString) throws Exception {
final SearchVersion version = SearchVersion.elasticsearch(versionString);
final IndexMappingTemplate mapping = new MessageIndexTemplateProvider().create(version, null);
final Map<String, Object> template = mapping.toTemplate(indexSetConfig, "sampleIndexTemplate");
final String fixture = fixtureFor(version);
JSONAssert.assertEquals(json(template), fixture, true);
}
use of org.graylog2.storage.SearchVersion in project graylog2-server by Graylog2.
the class MajorVersionConverterTest method convertEncodedValue.
@Test
void convertEncodedValue() {
final SearchVersion version = converter.convertFrom("OPENSEARCH:1.2.0");
assertThat(version).isEqualTo(SearchVersion.create(SearchVersion.Distribution.OPENSEARCH, Version.valueOf("1.2.0")));
}
use of org.graylog2.storage.SearchVersion in project graylog2-server by Graylog2.
the class IndexMappingFactory method createIndexMapping.
@Nonnull
public IndexMappingTemplate createIndexMapping(@Nonnull IndexSetConfig indexSetConfig) throws IgnoreIndexTemplate {
final SearchVersion elasticsearchVersion = node.getVersion().orElseThrow(() -> new ElasticsearchException("Unable to retrieve Elasticsearch version."));
final String templateType = indexSetConfig.indexTemplateType().orElse(IndexSetConfig.DEFAULT_INDEX_TEMPLATE_TYPE);
return resolveIndexMappingTemplateProvider(templateType).create(elasticsearchVersion, indexSetConfig);
}
use of org.graylog2.storage.SearchVersion in project graylog2-server by Graylog2.
the class ESVersionCheckPeriodical method doRun.
@Override
public void doRun() {
if (versionOverride.isPresent()) {
LOG.debug("Elasticsearch version is set manually. Not running check.");
return;
}
final Optional<SearchVersion> probedVersion = this.versionProbe.probe(this.elasticsearchHosts);
probedVersion.ifPresent(version -> {
if (compatible(this.initialElasticsearchVersion, version)) {
notificationService.fixed(Notification.Type.ES_VERSION_MISMATCH);
} else {
LOG.warn("Elasticsearch version currently running ({}) is incompatible with the one Graylog was started " + "with ({}) - a restart is required!", version, initialElasticsearchVersion);
final Notification notification = notificationService.buildNow().addType(Notification.Type.ES_VERSION_MISMATCH).addSeverity(Notification.Severity.URGENT).addDetail("initial_version", initialElasticsearchVersion.toString()).addDetail("current_version", version.toString());
notificationService.publishIfFirst(notification);
}
});
}
use of org.graylog2.storage.SearchVersion in project graylog2-server by Graylog2.
the class NodeAdapterES6 method version.
@Override
public Optional<SearchVersion> version() {
final Ping request = new Ping.Builder().build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Unable to retrieve Elasticsearch version");
return Optional.ofNullable(jestResult.getJsonObject().path("version").path("number").asText(null)).map(this::parseVersion).map(SearchVersion::elasticsearch);
}
Aggregations