Skip to content

Commit

Permalink
Upgrade to Spring Data Elasticsearch 3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
VanRoy committed Nov 8, 2019
1 parent 27cb1ce commit 1d40a2c
Show file tree
Hide file tree
Showing 15 changed files with 354 additions and 155 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Versions

| spring data jest | spring boot | spring data elasticsearch | jest | elasticsearch |
|:------------------:|:--------------------:|:-------------------------:|:------:|:-------------:|
| 3.3.0.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 |
Expand All @@ -33,7 +34,7 @@ Add the Maven dependency:
<dependency>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-boot-starter-data-jest</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
</dependency>

<!-- Only required for start local ES node -->
Expand Down Expand Up @@ -86,7 +87,7 @@ Add the Maven dependency:
<dependency>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-data-jest</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
</dependency>

<!-- Only required for start local / embedded ES node -->
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.vanroy</groupId>
<artifactId>spring-data-jest-build</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
<packaging>pom</packaging>

<name>Spring Data Jest Build</name>
Expand Down Expand Up @@ -47,10 +47,10 @@
<maven.compiler.target>1.8</maven.compiler.target>

<!-- Dependencies version -->
<springboot>2.1.2.RELEASE</springboot>
<spring>5.1.4.RELEASE</spring>
<springdataes>3.1.3.RELEASE</springdataes>
<springdatacommons>2.1.4.RELEASE</springdatacommons>
<springboot>2.2.1.RELEASE</springboot>
<spring>5.2.1.RELEASE</spring>
<springdataes>3.2.1.RELEASE</springdataes>
<springdatacommons>2.2.1.RELEASE</springdatacommons>
<jest>6.3.1</jest>
<gson>2.8.0</gson>
<awssigning>0.0.21</awssigning>
Expand All @@ -64,7 +64,7 @@
<aws>1.11.132</aws>
<log4j>2.7</log4j>

<elasticsearch>6.4.3</elasticsearch>
<elasticsearch>6.8.4</elasticsearch>

<!-- Version of maven plugins -->
<version.plugin.maven-compiler-plugin>3.6.1</version.plugin.maven-compiler-plugin>
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-sample-data-jest-aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-data-jest-build</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion spring-boot-sample-data-jest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-data-jest-build</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starter-data-jest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-data-jest-build</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.InternalSettingsPreparer;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeValidationException;
import org.elasticsearch.plugins.Plugin;
Expand All @@ -35,6 +34,7 @@
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.type.filter.AssignableTypeFilter;
import org.springframework.data.elasticsearch.client.NodeClientFactoryBean;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.SocketUtils;
Expand Down Expand Up @@ -166,7 +166,7 @@ private int createInternalNode() throws NodeValidationException {
Collection<Class<? extends Plugin>> plugins = scanPlugins();
plugins.add(Netty4Plugin.class);

this.node = new InternalNode(settingsBuilder.build(), plugins).start();
this.node = new NodeClientFactoryBean.TestNode(settingsBuilder.build(), plugins).start();

return Integer.parseInt(settingsBuilder.get("http.port"));
}
Expand All @@ -192,14 +192,4 @@ private static Collection<Class<? extends Plugin>> scanPlugins() {
})
.collect(Collectors.toSet());
}

/**
* Specific InternalNode class used to specify plugins.
*/
private static class InternalNode extends Node {

InternalNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public void before() {
elasticsearchOperations.refresh(Product.class);
}

@Test
public void should_repository_support_find_with_custom_query() {
assertThat(repository.findByName("sugar").size(), is(3));
}

@Test
public void should_repository_support_find() {
assertThat(repository.findByNameAndText("Sugar", "Cane sugar").size(), is(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import java.util.List;

import com.github.vanroy.springboot.autoconfigure.data.jest.entities.Product;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
* Created by akonczak on 04/09/15.
*/
public interface ProductRepository extends PagingAndSortingRepository<Product, String> {

@Query("{\"term\": { \"name\": { \"value\": \"?0\" } } }")
List<Product> findByName(String name);

List<Product> findByNameAndText(String name, String text);

List<Product> findByNameAndPrice(String name, Float price);
Expand Down
2 changes: 1 addition & 1 deletion spring-data-jest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-data-jest-build</artifactId>
<version>3.2.5.RELEASE</version>
<version>3.3.0.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit 1d40a2c

Please sign in to comment.