|
| 1 | += Spring Data for Elasticsearch image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"] |
| 2 | + |
| 3 | +The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services. |
| 4 | + |
| 5 | +The Spring Data Elasticsearch project provides integration with the https://www.elastic.co/[Elasticsearch] search engine. |
| 6 | +Key functional areas of Spring Data Elasticsearch are a POJO centric model for interacting with Elasticsearch Documents and easily writing a Repository style data access layer. |
| 7 | + |
| 8 | +This project is lead and maintained by the community. |
| 9 | + |
| 10 | +== Features |
| 11 | + |
| 12 | +* Spring configuration support using Java based `@Configuration` classes or an XML namespace for an ES client instances. |
| 13 | +* `ElasticsearchOperations` class and implementations that increases productivity performing common ES operations. |
| 14 | +Includes integrated object mapping between documents and POJOs. |
| 15 | +* Feature Rich Object Mapping integrated with Spring’s Conversion Service |
| 16 | +* Annotation based mapping metadata |
| 17 | +* Automatic implementation of `Repository` interfaces including support for custom search methods. |
| 18 | +* CDI support for repositories |
| 19 | + |
| 20 | +include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/code-of-conduct.adoc[] |
| 21 | + |
| 22 | +== Getting Started |
| 23 | + |
| 24 | +Here is a quick teaser of an application using Spring Data Repositories in Java: |
| 25 | + |
| 26 | +[source,java] |
| 27 | +---- |
| 28 | +public interface PersonRepository extends CrudRepository<Person, Long> { |
| 29 | +
|
| 30 | + List<Person> findByLastname(String lastname); |
| 31 | +
|
| 32 | + List<Person> findByFirstnameLike(String firstname); |
| 33 | +} |
| 34 | +
|
| 35 | +@Service |
| 36 | +public class MyService { |
| 37 | +
|
| 38 | + private final PersonRepository repository; |
| 39 | +
|
| 40 | + public MyService(PersonRepository repository) { |
| 41 | + this.repository = repository; |
| 42 | + } |
| 43 | +
|
| 44 | + public void doWork() { |
| 45 | +
|
| 46 | + repository.deleteAll(); |
| 47 | +
|
| 48 | + Person person = new Person(); |
| 49 | + person.setFirstname("Oliver"); |
| 50 | + person.setLastname("Gierke"); |
| 51 | + repository.save(person); |
| 52 | +
|
| 53 | + List<Person> lastNameResults = repository.findByLastname("Gierke"); |
| 54 | + List<Person> firstNameResults = repository.findByFirstnameLike("Oli"); |
| 55 | + } |
| 56 | +} |
| 57 | +---- |
| 58 | + |
| 59 | +=== Using the RestClient |
| 60 | + |
| 61 | +Please check the https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#elasticsearch.clients.configuration[official documentation]. |
| 62 | + |
| 63 | +include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/dependencies.adoc[] |
| 64 | + |
| 65 | +**Compatibility Matrix** |
| 66 | + |
| 67 | +The compatibility between Spring Data Elasticsearch, Elasticsearch client drivers and Spring Boot versions can be found in the https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions[reference documentation]. |
| 68 | + |
| 69 | +To use the Release candidate versions of the upcoming major version, use our Maven milestone repository and declare the appropriate dependency version: |
| 70 | + |
| 71 | +[source,xml] |
| 72 | +---- |
| 73 | +<dependency> |
| 74 | + <groupId>org.springframework.data</groupId> |
| 75 | + <artifactId>spring-data-elasticsearch</artifactId> |
| 76 | + <version>${version}.RCx</version> <!-- x being 1, 2, ... --> |
| 77 | +</dependency> |
| 78 | +---- |
| 79 | + |
| 80 | +include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/getting-help.adoc[] |
| 81 | + |
| 82 | +include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/license.adoc[] |
| 83 | + |
0 commit comments