[英]How to test Elasticsearch index creation?
I would like to write a JUnit Test using any kind of embedded Elasticsearch engine in order to test my services which should create indexes with mappings on start-up. 我想使用任何嵌入式Elasticsearch引擎编写JUnit测试,以测试我的服务,该服务应在启动时使用映射创建索引。 What is the best way to do it?
最好的方法是什么?
Probably, it would be also enough to use ESTestCase. 也许,使用ESTestCase也足够了。 Unfortunately, I cannot find simple usage examples.
不幸的是,我找不到简单的用法示例。 Could anyone provide one?
有人可以提供吗?
There is no embedded Elasticsearch since 5.x any more. 从5.x版本开始,不再有嵌入式Elasticsearch。 I would use Testcontainers for this: https://github.com/dadoonet/testcontainers-java-module-elasticsearch
我将为此使用Testcontainers: https : //github.com/dadoonet/testcontainers-java-module-elasticsearch
PS: This code will soon move to the Testcontainers repo. PS:此代码将很快移至Testcontainers存储库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.