我的原有javaEE项目中使用了lucene 3.6 但是我把 Elasticsearch 2.4.0(lucene
5.2.2)集成进去以后,出现lucene版本冲突问题 该如何解决,我的config文件如下
package com.dc.lab.modules.content.configuration;
import java.io.IOException;
import java.net.InetAddress;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
@Configuration
@EnableElasticsearchRepositories(basePackages ="com.dc.lab.modules.content.repository")
public class ESConfig {
@Bean
ElasticsearchOperations elasticsearchTemplate() throws IOException
{
Settings settings = Settings.builder()
.put("client.transport.sniff", "true")
.build();
Client client = TransportClient.builder().settings(settings).build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("116.57.99.12"), 9300));
return new ElasticsearchTemplate(client);
}
}
5.2.2)集成进去以后,出现lucene版本冲突问题 该如何解决,我的config文件如下
package com.dc.lab.modules.content.configuration;
import java.io.IOException;
import java.net.InetAddress;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
@Configuration
@EnableElasticsearchRepositories(basePackages ="com.dc.lab.modules.content.repository")
public class ESConfig {
@Bean
ElasticsearchOperations elasticsearchTemplate() throws IOException
{
Settings settings = Settings.builder()
.put("client.transport.sniff", "true")
.build();
Client client = TransportClient.builder().settings(settings).build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("116.57.99.12"), 9300));
return new ElasticsearchTemplate(client);
}
}
0 个回复