DATAES-782 - Make underlying TransportClient accessible.

Original PR: #421
This commit is contained in:
Peter-Josef Meisch 2020-04-04 19:19:26 +02:00 committed by GitHub
parent e449944e3b
commit 3afd6fd427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -343,5 +343,9 @@ public class ElasticsearchTemplate extends AbstractElasticsearchTemplate {
} catch (Exception ignored) {}
return null;
}
public Client getClient() {
return client;
}
// endregion
}

View File

@ -131,6 +131,13 @@ public class ElasticsearchTransportTemplateTests extends ElasticsearchTemplateTe
assertThat(fetchSourceContext.excludes()).containsExactlyInAnyOrder("excl");
}
@Test // DATAES-782
void shouldProvideClient() {
Client client = ((ElasticsearchTemplate) operations).getClient();
assertThat(client).isNotNull();
}
@Data
@Document(indexName = "test-index-sample-core-transport-template", replicas = 0, refreshInterval = "-1")
static class SampleEntity {