yoav.str
yoav.str

Reputation: 1542

spring boot elastic search -configure data source

I am tryinging to configure spring data boot sand ES project in my pom.xml i have :

@Configuration
 @EnableElasticsearchRepositories(basePackages = "com.yoyo.elastic.repository")
 public class ElasticConfiguration {


@Bean
public NodeBuilder nodeBuilder() {
    return new NodeBuilder();
}




@Bean
public ElasticsearchOperations elasticsearchTemplate() throws IOException {
    File tmpDir = File.createTempFile("elastic", Long.toString(System.nanoTime()));
    System.out.println("Temp directory: " + tmpDir.getAbsolutePath());

    final Client client = nodeBuilder().local(true).node().client();
    return  new ElasticsearchTemplate(client);
}

}

in my pom xml I have this dep :

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency> 

which should supplay the driver but i keep on getting : Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

Upvotes: 0

Views: 905

Answers (1)

Bobzone
Bobzone

Reputation: 286

I had the same issue when trying to run some exercises with Spring Boot and ElasticSearch.

Right now I figured out that if you have the

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

Alongside spring-boot-starter-data-elasticsearch and don't add additional config classes (where you would configure the DataSource) spring boot will complain.

Other solution would be to actually add a datasource property to application.properties and configure standalone database (like H2)

Upvotes: 2

Related Questions