Need help with spring-data-jest?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

VanRoy
209 Stars 82 Forks Apache License 2.0 125 Commits 12 Opened issues

Description

Spring Data Implementation for Jest

Services available

!
?

Need anything else?

Contributors list

No Data

Spring Data Jest

Apache License 2 Build Status Maven Central

Spring Data implementation for ElasticSearch based on Jest Rest client

Useful to use Spring Data with ElasticSearch cluster accessible only by HTTP ( for example on AWS).

Versions

| spring data jest | spring boot | spring data elasticsearch | jest | elasticsearch | |:------------------:|:--------------------:|:-------------------------:|:------:|:-------------:| | 3.3.3.RELEASE | 2.2.1 | 3.2.1.RELEASE | 6.3.1 | 6.8.4 | | 3.2.5.RELEASE | 2.1.2 | 3.1.3.RELEASE | 6.3.1 | 6.4.3 | | 3.1.5.RELEASE | 2.0.5 | 3.0.10.RELEASE | 5.3.4 | 5.5.0 | | 3.0.0.RELEASE | 2.0.0.M4 | 3.0.0.RELEASE | 5.3.2 | 5.5.0 | | 2.3.1.RELEASE | 1.5.x | 2.1.0.RELEASE | 2.0.4 | 2.4.4 | | 2.2.0.RELEASE | >= 1.4.3 | 2.0.6.RELEASE | 2.0.4 | 2.4.3 | | 2.1.4.RELEASE | < 1.4.3 | 2.0.5.RELEASE | 2.0.3 | 2.2.0 | | 1.0.2.RELEASE | 1.3.x | 1.3.4.RELEASE | 1.0.3 | 1.5.2 |

Quick Start with Spring Boot

Maven configuration

Add the Maven dependency:

    com.github.vanroy
    spring-boot-starter-data-jest
    3.3.3.RELEASE




    org.apache.logging.log4j
    log4j-core

For specific case of AWS ES Domain (with Request Signing) add this dependency:

    vc.inreach.aws
    aws-signing-request-interceptor
    0.0.21

Application

@SpringBootApplication(exclude = {ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Configuration ( application.yml )

spring:
    data:
        jest:
            uri: http://localhost:9200

        # Useful only for AWS request signing ( not required on EC2 instance, it's auto-discovered )
        aws-region: eu-west-1

Quick Start without Spring Boot

Maven configuration

Add the Maven dependency:

    com.github.vanroy
    spring-data-jest
    3.3.3.RELEASE




    org.apache.logging.log4j
    log4j-core

XML Namespace

You can set up repository scanning via xml configuration, which will happily create your repositories.

<!-- Elastic search test node -->
<node-client id="client" local="true" cluster-name="#{T(java.util.UUID).randomUUID().toString()}" http-enabled="true" path-data="target/elasticsearchTestData" path-home="src/test/resources/test-home-dir" path-configuration="node-client-configuration.yml"></node-client>


<!-- ElasticSearch Jest Client -->
<bean id="jestClient" factory-bean="jestClientFactory" factory-method="getObject" destroy-method="close"></bean>

<bean id="jestClientConfigBuilder" class="io.searchbox.client.config.HttpClientConfig.Builder">
    <constructor-arg type="java.lang.String" value="http://localhost:9200"></constructor-arg>
</bean>

<bean id="jestClientConfig" factory-bean="jestClientConfigBuilder" factory-method="build"></bean>

<bean id="jestClientFactory" class="io.searchbox.client.JestClientFactory">
    <property name="httpClientConfig" ref="jestClientConfig"></property>
</bean>

<!-- Elasticsearch Jest Template -->
<bean id="jestElasticsearchTemplate" class="com.github.vanroy.springdata.jest.JestElasticsearchTemplate">
    <constructor-arg ref="jestClient"></constructor-arg>
</bean>

Samples

Sample with Spring Boot and embedded Elasticsearch :

https://github.com/VanRoy/spring-data-jest/tree/master/spring-boot-sample-data-jest

Sample with Spring Boot and Elasticsearch on AWS (managed) :

https://github.com/VanRoy/spring-data-jest/tree/master/spring-boot-sample-data-jest-aws

Sponsors

JetBrains

JetBrains

JetBrains supports our open source project by sponsoring a All Products Packs within their Free Open Source License program.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.