0
votes

I have one question, because I can't find anywhere information which version of elasticsearch is compatible with 1.5.2.RELEASE spring boot app generate by jhipster. Everything works perfectly when I run it on windows with properties in my application-dev.yml

        elasticsearch:
        cluster-name:
        cluster-nodes:
        properties:
            path:
              logs: target/elasticsearch/log
              data: target/elasticsearch/data

On production I have only warning that my app cant connect with elasticsearch service. It is normal, because I didn't run it on port 9300... But I have another problem. When I try deploy it to my linux server (debian) I have several errors 'Cannot resolve reference to bean elasticsearchTemplate' and another errors with nested exceptions etc... all errors about elasticsearch and constructor parameters.

I tried download elasticsearch on widows and test it, so I done it. I downloaded elasticsearch version 5.4.1 and configured it... But it is still invisible for my web app.

My actually property for elastic is

        elasticsearch:
        cluster-name: elasticsearch
        cluster-nodes: localhost:9300

Any solutions and suggests?

Thanks

1
spring-data-elasticsearch does not support Elasticsearch v5. Please use Elasticsearch v2 until the Kay release in a few months. github.com/spring-projects/spring-data-commons/wiki/…Jon Ruddell

1 Answers

2
votes

You don't need to worry about versioning, because that's the work of spring-boot.

Spring Boot -> Dependency management

Each release of Spring Boot provides a curated list of dependencies it supports. In practice, you do not need to provide a version for any of these dependencies in your build configuration as Spring Boot is managing that for you. When you upgrade Spring Boot itself, these dependencies will be upgraded as well in a consistent way.

And back to JHipster as noted in the Elasticsearch documentation:
Using in Production

In production, JHipster expects an external Elasticsearch instance. By default, the application looks for an Elasticsearch instance running on localhost. This can be configured by using the standard Spring Boot properties, in the application-prod.yml file.

When you create a JHipster project and specify that will be using ElasticSearch than a docker configuration file is created under /src/main/docker/ named elasticsearch.yml containing:

version: '2'
services:
    jhipsterelasticsearchsampleapplication-elasticsearch:
        image: elasticsearch:2.4.1
        # volumes:
        #     - ~/volumes/jhipster/jhipsterElasticsearchSampleApplication/elasticsearch/:/usr/share/elasticsearch/data/
        ports:
            - 9200:9200
            - 9300:9300

The above example is extracted from an example of an ElasticSearch project by JHipster team at jhipster-sample-app-elasticsearch

So before starting your app on production make sure that you have started ElasticSearch instance. A solution is to start it with docker-compose and you can use that config file like this: docker-compose -f path-to/elasticsearch.yml up -d