Our current application is running under Spring Boot 1.5 (comes with Elastic Search 2.X)
We use Embedded/In-Memory Elastic search instance and use Node client to connect to the Embedded/In-Memory Elastic instance.
We are looking to migrate away from Embedded Elastic Search to external Elastic Search Instance.
This means we'll need to migrate away from Node Client and use either
Transport Client or Low-Level-Rest-Client or High-Level-Rest-Client
Our Spring Boot Config for Node Client looks like this:
@Configuration
@EnableElasticsearchRepositories
public class ElasticConfiguration {
@Bean
NodeBuilder nodeBuilder(){ return new NodeBuilder(); }
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws IOException {
File tmpDir = File.createTempFile("elastic") );
Settings.Builder elasticsearchSettings = Settings.settingsBuilder()
.put("http.enabled", "true") // 1
.put("index.number_of_shards", "1")
.put("path.data", new File(tmpDir, "data").getAbsolutePath())
.put("path.logs", new File(tmpDir, "logs").getAbsolutePath())
.put("path.work", new File(tmpDir, "work").getAbsolutePath())
.put("path.home", tmpDir);
return new ElasticsearchTemplate(nodeBuilder().local(true)
.settings(elasticsearchSettings.build())
.node()
.client());
}
Question:
1) If we migrate from Elastic Node client to Elastic Transport client, will it mean heavy code changes for the currently coded Elastic pieces
(outside of the elastic config class that creates node client)
2) If we migrate from Node Client to Using Rest Client:
i) Again, outside of the Elastic Config code changes, will it mean heavy code changes for the currently coded Elastic pieces?
ii) How would the above SpringBoot Elastic Config for Rest client look like? any sample code?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…