Spring Data Jest

Spring Data Implementation for Jest

License

License

Categories

Categories

Data Jest Databases
GroupId

GroupId

com.github.vanroy
ArtifactId

ArtifactId

spring-data-jest
Last Version

Last Version

3.3.4.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

Spring Data Jest
Spring Data Implementation for Jest

Download spring-data-jest

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.vanroy/spring-data-jest/ -->
<dependency>
    <groupId>com.github.vanroy</groupId>
    <artifactId>spring-data-jest</artifactId>
    <version>3.3.4.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.vanroy/spring-data-jest/
implementation 'com.github.vanroy:spring-data-jest:3.3.4.RELEASE'
// https://jarcasting.com/artifacts/com.github.vanroy/spring-data-jest/
implementation ("com.github.vanroy:spring-data-jest:3.3.4.RELEASE")
'com.github.vanroy:spring-data-jest:jar:3.3.4.RELEASE'
<dependency org="com.github.vanroy" name="spring-data-jest" rev="3.3.4.RELEASE">
  <artifact name="spring-data-jest" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.vanroy', module='spring-data-jest', version='3.3.4.RELEASE')
)
libraryDependencies += "com.github.vanroy" % "spring-data-jest" % "3.3.4.RELEASE"
[com.github.vanroy/spring-data-jest "3.3.4.RELEASE"]

Dependencies

compile (8)

Group / Artifact Type Version
org.springframework.data : spring-data-elasticsearch jar 3.2.1.RELEASE
org.springframework.data : spring-data-commons jar 2.2.1.RELEASE
org.elasticsearch : elasticsearch jar 6.8.4
org.elasticsearch.client : transport jar 6.8.4
org.elasticsearch.plugin : transport-netty4-client jar 6.8.4
commons-logging : commons-logging jar 1.2
io.searchbox : jest jar 6.3.1
com.google.code.gson : gson jar 2.8.0

test (9)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.1.9
org.hamcrest : hamcrest-library jar 1.3
org.hamcrest : hamcrest-core jar 1.3
junit : junit jar 4.13.1
org.mockito : mockito-core jar 1.10.19
org.projectlombok : lombok jar 1.18.2
org.springframework : spring-test jar 5.2.1.RELEASE
org.apache.logging.log4j : log4j-api jar 2.7
org.apache.logging.log4j : log4j-core jar 2.7

Project Modules

There are no modules declared in this project.

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.4.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:

<dependency>
    <groupId>com.github.vanroy</groupId>
    <artifactId>spring-boot-starter-data-jest</artifactId>
    <version>3.3.4.RELEASE</version>
</dependency>

<!-- Only required for start local ES node -->
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
</dependency>

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

<dependency>
    <groupId>vc.inreach.aws</groupId>
    <artifactId>aws-signing-request-interceptor</artifactId>
    <version>0.0.21</version>
</dependency>

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:

<dependency>
    <groupId>com.github.vanroy</groupId>
    <artifactId>spring-data-jest</artifactId>
    <version>3.3.4.RELEASE</version>
</dependency>

<!-- Only required for start local / embedded ES node -->
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
</dependency>

XML Namespace

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

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd">

    <!-- Elastic search test node -->
    <elasticsearch: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"/>


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

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

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

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

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

</beans>

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

Plugins loading

All plugins located in org.elasticsearch.plugin are loaded by default. All plugins located in packages specified in property spring.data.jest.pluginPackages are also loaded.

Example for Expression-lang

In pom.xml, add plugin dependency :

 <dependency>
   <groupId>org.codelibs.elasticsearch.module</groupId>
   <artifactId>lang-expression</artifactId>
   <version>...</version>
 </dependency>

In application.yml, add following :

spring:
    data:
        jest:
            pluginPackages: org.elasticsearch.script.expression

Sponsors

JetBrains

JetBrains

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

Versions

Version
3.3.4.RELEASE
3.3.3.RELEASE
3.3.2.RELEASE
3.3.1.RELEASE
3.3.0.RELEASE
3.2.5.RELEASE
3.2.4.RELEASE
3.2.3.RELEASE
3.2.2.RELEASE
3.2.1.RELEASE
3.2.0.RELEASE
3.1.5.RELEASE
3.1.4.RELEASE
3.1.3.RELEASE
3.1.2.RELEASE
3.1.1.RELEASE
3.1.0.RELEASE
3.0.0.RELEASE
2.3.2.RELEASE
2.3.1.RELEASE
2.3.0.RELEASE
2.2.0.RELEASE
2.1.4.RELEASE
2.1.3.RELEASE
2.1.2.RELEASE
2.1.1.RELEASE
2.1.0.RELEASE
2.0.0.RELEASE
1.0.2.RELEASE
1.0.1.RELEASE
1.0.0.RELEASE