SlideShare a Scribd company logo
1
ElasticON Global
Peter-Josef Meisch
Spring Data Elasticsearch Project Lead
2
This presentation and the accompanying oral presentation contain forward-looking statements, including statements
concerning plans for future offerings; the expected strength, performance or benefits of our offerings; and our future
operations and expected performance. These forward-looking statements are subject to the safe harbor provisions
under the Private Securities Litigation Reform Act of 1995. Our expectations and beliefs in light of currently
available information regarding these matters may not materialize. Actual outcomes and results may differ materially
from those contemplated by these forward-looking statements due to uncertainties, risks, and changes in
circumstances, including, but not limited to those related to: the impact of the COVID-19 pandemic on our business
and our customers and partners; our ability to continue to deliver and improve our offerings and successfully
develop new offerings, including security-related product offerings and SaaS offerings; customer acceptance and
purchase of our existing offerings and new offerings, including the expansion and adoption of our SaaS offerings;
our ability to realize value from investments in the business, including R&D investments; our ability to maintain and
expand our user and customer base; our international expansion strategy; our ability to successfully execute our
go-to-market strategy and expand in our existing markets and into new markets, and our ability to forecast customer
retention and expansion; and general market, political, economic and business conditions.
Additional risks and uncertainties that could cause actual outcomes and results to differ materially are included in
our filings with the Securities and Exchange Commission (the “SEC”), including our Annual Report on Form 10-K for
the most recent fiscal year, our quarterly report on Form 10-Q for the most recent fiscal quarter, and any
subsequent reports filed with the SEC. SEC filings are available on the Investor Relations section of Elastic’s
website at ir.elastic.co and the SEC’s website at www.sec.gov.
Any features or functions of services or products referenced in this presentation, or in any presentations, press
releases or public statements, which are not currently available or not currently available as a general availability
release, may not be delivered on time or at all. The development, release, and timing of any features or functionality
described for our products remains at our sole discretion. Customers who purchase our products and services
should make the purchase decisions based upon services and product features and functions that are currently
available.
All statements are made only as of the date of the presentation, and Elastic assumes no obligation to, and does not
currently intend to, update any forward-looking statements or statements relating to features or functions of services
or products, except as required by law.
Forward-Looking Statements
3
Nothing will stop you being creative more
effectively as the fear of making a mistake.
John Cleese
4
Next Level
Elasticsearch
Integration with Spring
Data Elasticsearch
What is Spring Data
Elasticsearch?
“Spring Data’s mission is to provide a
familiar and consistent, Spring-based
programming model for data access
while still retaining the special traits of
the underlying data store.”
Configure the connection
to Elasticsearch
Configure the connection to Elasticsearch
@Configuration
public class RestClientConfig extends
AbstractElasticsearchConfiguration {
@Override @Bean public RestHighLevelClient elasticsearchClient() {
ClientConfiguration clientConfiguration =
ClientConfiguration.builder()
.connectedTo("localhost:9200")
.build();
return RestClients.create(clientConfiguration).rest();
}
}
Configure the connection to Elasticsearch
@Configuration
public class RestClientConfig extends
AbstractElasticsearchConfiguration {
@Override @Bean public RestHighLevelClient elasticsearchClient() {
ClientConfiguration clientConfiguration =
ClientConfiguration.builder()
.connectedTo("localhost:9200")
.withProxy("localhost:8080")
.build();
return RestClients.create(clientConfiguration).rest();
}
}
Configure the connection to Elasticsearch
@Configuration
public class RestClientConfig extends
AbstractElasticsearchConfiguration {
@Override @Bean public RestHighLevelClient elasticsearchClient() {
ClientConfiguration clientConfiguration =
ClientConfiguration.builder()
.connectedTo("localhost:9200")
.usingSsl()
.build();
return RestClients.create(clientConfiguration).rest();
}
}
Configure the connection to Elasticsearch
@Configuration
public class RestClientConfig extends
AbstractElasticsearchConfiguration {
@Override @Bean public RestHighLevelClient elasticsearchClient() {
ClientConfiguration clientConfiguration =
ClientConfiguration.builder()
.connectedTo("localhost:9200")
.withBasicAuth("myuser", "mypassword")
.build();
return RestClients.create(clientConfiguration).rest();
}
}
Configure the connection to Elasticsearch
@Configuration
public class RestClientConfig extends
AbstractElasticsearchConfiguration {
@Override @Bean public RestHighLevelClient elasticsearchClient() {
ClientConfiguration clientConfiguration =
ClientConfiguration.builder()
.connectedTo("localhost:9200")
.withPathPrefix("customer1")
.build();
return RestClients.create(clientConfiguration).rest();
}
}
Configure the connection to Elasticsearch
Supplier<HttpHeaders> currentTimeHeaders = () -> {
HttpHeaders headers = new HttpHeaders();
headers.add("currentTime",
LocalDateTime.now()
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
return headers;
};
ClientConfiguration clientConfiguration =
ClientConfiguration.builder()
.connectedTo("localhost:9200")
.withHeaders(currentTimeHeaders)
.build();
Entity definition
Entity definition
public class Person {
@Id
private String id;
private String lastName;
private String firstName;
private LocalDate birthDate;
}
Entity definition
@Document(indexName = "person")
public class Person {
@Id
private String id;
private String lastName;
private String firstName;
private LocalDate birthDate;
}
Entity definition
@Document(indexName = "person")
public class Person {
@Id
private String id;
@Field(type = FieldType.Text)
private String lastName;
@Field(type = FieldType.Text)
private String firstName;
private LocalDate birthDate;
}
Entity definition
@Document(indexName = "person")
public class Person {
@Id
private String id;
@Field(type = FieldType.Text)
private String lastName;
@Field(type = FieldType.Text)
private String firstName;
@Field(type = FieldType.Date, format = DateFormat.basic_date)
private LocalDate birthDate;
}
ElasticsearchOperations
IndexOperations
● index creation and deletion
● index settings
● index mappings
● index templates
● alias management
● refresh operation
IndexOperations
private ElasticsearchOperations operations ; // injected by Spring
IndexOperations indexOps = operations.indexOps(Person.class);
indexOps.create();
indexOps.putMapping();
PutTemplateRequest putTemplateRequest =
PutTemplateRequest.builder("template-name", "log-*")
.withSettings(settings)
.withMappings(mapping)
.withAliasActions(aliasActions)
.build();
indexOps.putTemplate(putTemplateRequest);
IndexOperations
private ElasticsearchOperations operations; // injected by Spring
IndexOperations indexOps = operations.indexOps(Person.class) ;
indexOps.create();
indexOps.putMapping();
PutTemplateRequest putTemplateRequest =
PutTemplateRequest.builder("template-name", "log-*")
.withSettings(settings)
.withMappings(mapping)
.withAliasActions(aliasActions)
.build();
indexOps.putTemplate(putTemplateRequest);
IndexOperations
private ElasticsearchOperations operations; // injected by Spring
IndexOperations indexOps = operations.indexOps(Person.class);
indexOps.create();
indexOps.putMapping();
PutTemplateRequest putTemplateRequest =
PutTemplateRequest.builder("template-name", "log-*")
.withSettings(settings)
.withMappings(mapping)
.withAliasActions(aliasActions)
.build();
indexOps.putTemplate(putTemplateRequest);
IndexOperations
private ElasticsearchOperations operations; // injected by Spring
IndexOperations indexOps = operations.indexOps(Person.class);
indexOps.create();
indexOps.putMapping();
PutTemplateRequest putTemplateRequest =
PutTemplateRequest.builder("template-name", "log-*")
.withSettings(settings)
.withMappings(mapping)
.withAliasActions(aliasActions)
.build();
indexOps.putTemplate(putTemplateRequest) ;
DocumentOperations
● save
● get
● delete
● exists
● update
SearchOperations
● count
● search
Query based operations
NativeSearchQuery
import static org.elasticsearch.index.query.QueryBuilders.*;
import static
org.elasticsearch.search.aggregations.AggregationBuilders.*;
Query query =
new NativeSearchQueryBuilder()
.addAggregation( terms("lastNames").field("lastName").size(10) )
.withQuery( matchQuery("firstName", firstName) )
.build();
SearchHits<Person> searchHits = operations.search(query,
Person.class);
StringQuery
Query query = new StringQuery( "{" +
" "bool": {" +
" "must": [" +
" {" +
" "match": {" +
" "lastName": "Smith"" +
" }" +
" }" +
" ]" +
" }" +
"}");
SearchHits<Person> searchHits = operations.search(query,
Person.class);
CriteriaQuery
Criteria criteria =
new Criteria("lastName").is("Smith")
.and("firstName").is("James");
Query query = new CriteriaQuery(criteria);
SearchHits<Person> searchHits = operations.search(query,
Person.class);
Return types
SearchHit<T
● id
● index name
● the entity of type T
● score
● sort values
● highlight fields
● inner hits
SearchHits<T
● number of total hits
● total hits relation (eq, gte)
● list of SearchHit<T> objects
● max score
● aggregations
ElasticsearchRepository
Repository
interface PersonRepository extends
ElasticsearchRepository< Person, String > {
}
// ElasticsearchRepository
// +PagingAndSortingRepository
// + CrudRepository
// + Repository
Repository
count()
delete(T)
deleteAll()
deleteAll(Iterable<? extends T)
deleteById(ID)
existsById(ID)
findAll()
findAll(Pageable)
findAll(Sort)
findAllById(Iterable<ID>)
findById(ID)
save(T)
saveAll(Iterable<T>)
searchSimilar(T entity, String[] fields, Pageable pageable)
Repository methods
interface PersonRepository extends
ElasticsearchRepository< Person, String > {
List<Person> searchByFirstName(String name);
List<Person> findByFirstNameOrderByLastNameAsc(String name);
List<Person> queryByBirthDateBefore(LocalDate date);
}
Repository methods
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
@Query(value = "{"fuzzy":{"lastName":"?0"}}")
List<Person> findByLastNameFuzzy(String lastName);
}
Repository method return types
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
List<Person> searchByFirstName(String name);
}
Repository method return types
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
Stream<Person> searchByFirstName(String name);
}
Repository method return types
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
List<SearchHit<Person>> searchByFirstName(String name);
}
Repository method return types
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
Stream<SearchHit<Person>> searchByFirstName(String name);
}
Repository method return types
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
SearchHits<Person> searchByFirstName(String name);
}
Repository method return types
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
SearchPage<Person> searchByFirstName(String name, Pageable page);
}
Repository usage
@RestController @RequestMapping(”/persons”)
public class PersonController {
private PersonRepository repository;
public PersonController(PersonRepository repository) {
this.repository = repository;
}
@GetMapping(”/firstName/{name}”)
List<Person> byFirstName( @PathVariable(”name”) String name) {
return repository.searchByFirstName(name) ;
}
}
Repository method with highlight definition
interface PersonRepository extends
ElasticsearchRepository<Person, String> {
@Highlight(fields = {
@HighlightField(name = "firstName")
})
SearchHits<Person> searchByFirstName(String name);
}
repository.searchByFirstName(”James”)
.forEach(searchHit -> {
List<String> highlights =
searchHit.getHighlightField("firstName");
// ...
});
What else?
Lifecycle events
@Component
public class PersonBeforeConvertCallback implements
BeforeConvertCallback<Person> {
@Override
public Person onBeforeConvert(Person person,
IndexCoordinates indexCoordinates) {
if (person.getId() == null) {
person.setId(UUID.randomUUID().toString());
}
return person;
}
}
Auditable Entity
@Document(indexName = "person")
public class Person implements Persistable<String> {
@Id private String id;
@CreatedDate @Field(type = FieldType.Date, format =
DateFormat.basic_date_time)
private Instant created;
@CreatedBy
private String createdBy;
@Override
public boolean isNew() {
return id == null || (createdBy == null && created == null);
}
}
We need contributors!
Spring Data Elasticsearch is a
community-driven project
50
Thank You!
https://spring.io/projects/spring-data-elasticsearch
https://github.com/spring-projects/spring-data-elasticsearch
@sothawo
pj.meisch@sothawo.com

More Related Content

What's hot

NOSQL vs SQL
NOSQL vs SQLNOSQL vs SQL
NOSQL vs SQL
Mohammed Fazuluddin
 
Power Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDBPower Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDB
InfluxData
 
Infrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload DeploymentInfrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload Deployment
Databricks
 
FIWARE Wednesday Webinars - Introduction to NGSI-LD
FIWARE Wednesday Webinars - Introduction to NGSI-LDFIWARE Wednesday Webinars - Introduction to NGSI-LD
FIWARE Wednesday Webinars - Introduction to NGSI-LD
FIWARE
 
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...
Nicolas Fränkel
 
Microservices-DDD-Telosys-Devoxx-FR-2022
Microservices-DDD-Telosys-Devoxx-FR-2022Microservices-DDD-Telosys-Devoxx-FR-2022
Microservices-DDD-Telosys-Devoxx-FR-2022
Laurent Guérin
 
Kibana overview
Kibana overviewKibana overview
Kibana overview
Rinat Tainov
 
Fleet and elastic agent
Fleet and elastic agentFleet and elastic agent
Fleet and elastic agent
Ismaeel Enjreny
 
PostgreSQL
PostgreSQLPostgreSQL
[넥슨] kubernetes 소개 (2018)
[넥슨] kubernetes 소개 (2018)[넥슨] kubernetes 소개 (2018)
[넥슨] kubernetes 소개 (2018)
용호 최
 
Prometheus on NKS
Prometheus on NKSPrometheus on NKS
Prometheus on NKS
Jo Hoon
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
stewashton
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Amazon Web Services
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
Yevgeniy Brikman
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
Derek Stainer
 
Introduction à ElasticSearch
Introduction à ElasticSearchIntroduction à ElasticSearch
Introduction à ElasticSearchFadel Chafai
 
Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019
Laurent Guérin
 
Telosys tutorial - Code generation for a Python web application based on Bott...
Telosys tutorial - Code generation for a Python web application based on Bott...Telosys tutorial - Code generation for a Python web application based on Bott...
Telosys tutorial - Code generation for a Python web application based on Bott...
Laurent Guérin
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
joshbeard
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
Arto Santala
 

What's hot (20)

NOSQL vs SQL
NOSQL vs SQLNOSQL vs SQL
NOSQL vs SQL
 
Power Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDBPower Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDB
 
Infrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload DeploymentInfrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload Deployment
 
FIWARE Wednesday Webinars - Introduction to NGSI-LD
FIWARE Wednesday Webinars - Introduction to NGSI-LDFIWARE Wednesday Webinars - Introduction to NGSI-LD
FIWARE Wednesday Webinars - Introduction to NGSI-LD
 
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...
 
Microservices-DDD-Telosys-Devoxx-FR-2022
Microservices-DDD-Telosys-Devoxx-FR-2022Microservices-DDD-Telosys-Devoxx-FR-2022
Microservices-DDD-Telosys-Devoxx-FR-2022
 
Kibana overview
Kibana overviewKibana overview
Kibana overview
 
Fleet and elastic agent
Fleet and elastic agentFleet and elastic agent
Fleet and elastic agent
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
[넥슨] kubernetes 소개 (2018)
[넥슨] kubernetes 소개 (2018)[넥슨] kubernetes 소개 (2018)
[넥슨] kubernetes 소개 (2018)
 
Prometheus on NKS
Prometheus on NKSPrometheus on NKS
Prometheus on NKS
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
 
Introduction à ElasticSearch
Introduction à ElasticSearchIntroduction à ElasticSearch
Introduction à ElasticSearch
 
Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019
 
Telosys tutorial - Code generation for a Python web application based on Bott...
Telosys tutorial - Code generation for a Python web application based on Bott...Telosys tutorial - Code generation for a Python web application based on Bott...
Telosys tutorial - Code generation for a Python web application based on Bott...
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 

Similar to Next-level integration with Spring Data Elasticsearch

Eland: A Python client for data analysis and exploration
Eland: A Python client for data analysis and explorationEland: A Python client for data analysis and exploration
Eland: A Python client for data analysis and exploration
Elasticsearch
 
The importance of normalizing your security data to ECS
The importance of normalizing your security data to ECSThe importance of normalizing your security data to ECS
The importance of normalizing your security data to ECS
Elasticsearch
 
Public sector keynote
Public sector keynotePublic sector keynote
Public sector keynote
Elasticsearch
 
Finding relevant results faster with Elasticsearch
Finding relevant results faster with ElasticsearchFinding relevant results faster with Elasticsearch
Finding relevant results faster with Elasticsearch
Elasticsearch
 
Managing the Elastic Stack at Scale
Managing the Elastic Stack at ScaleManaging the Elastic Stack at Scale
Managing the Elastic Stack at Scale
Elasticsearch
 
Breaking silos between DevOps and SecOps with Elastic
Breaking silos between DevOps and SecOps with ElasticBreaking silos between DevOps and SecOps with Elastic
Breaking silos between DevOps and SecOps with Elastic
Elasticsearch
 
How we built this: Data tiering, snapshots, and asynchronous search
How we built this: Data tiering, snapshots, and asynchronous searchHow we built this: Data tiering, snapshots, and asynchronous search
How we built this: Data tiering, snapshots, and asynchronous search
Elasticsearch
 
Automating the Elastic Stack
Automating the Elastic StackAutomating the Elastic Stack
Automating the Elastic Stack
Elasticsearch
 
From secure VPC links to SSO with Elastic Cloud
From secure VPC links to SSO with Elastic CloudFrom secure VPC links to SSO with Elastic Cloud
From secure VPC links to SSO with Elastic Cloud
Elasticsearch
 
Migrating to Elasticsearch Service on Elastic Cloud
Migrating to Elasticsearch Service on Elastic CloudMigrating to Elasticsearch Service on Elastic Cloud
Migrating to Elasticsearch Service on Elastic Cloud
Elasticsearch
 
Introduction to Visualforce for Mobile Devices
Introduction to Visualforce for Mobile DevicesIntroduction to Visualforce for Mobile Devices
Introduction to Visualforce for Mobile Devices
Salesforce Developers
 
Elasticsearch: From development to production in 15 minutes
Elasticsearch: From development to production in 15 minutesElasticsearch: From development to production in 15 minutes
Elasticsearch: From development to production in 15 minutes
Elasticsearch
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
Salesforce Developers
 
SIEM, malware protection, deep data visibility — for free
SIEM, malware protection, deep data visibility — for freeSIEM, malware protection, deep data visibility — for free
SIEM, malware protection, deep data visibility — for free
Elasticsearch
 
Autoscaling: From zero to production seamlessly
Autoscaling: From zero to production seamlesslyAutoscaling: From zero to production seamlessly
Autoscaling: From zero to production seamlessly
Elasticsearch
 
Streamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft AzureStreamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft Azure
Elasticsearch
 
Streamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft AzureStreamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft Azure
Elasticsearch
 
Securing the Elastic Stack for free
Securing the Elastic Stack for freeSecuring the Elastic Stack for free
Securing the Elastic Stack for free
Elasticsearch
 
Elastic Cloud keynote
Elastic Cloud keynoteElastic Cloud keynote
Elastic Cloud keynote
Elasticsearch
 
Creating stellar customer support experiences using search
Creating stellar customer support experiences using searchCreating stellar customer support experiences using search
Creating stellar customer support experiences using search
Elasticsearch
 

Similar to Next-level integration with Spring Data Elasticsearch (20)

Eland: A Python client for data analysis and exploration
Eland: A Python client for data analysis and explorationEland: A Python client for data analysis and exploration
Eland: A Python client for data analysis and exploration
 
The importance of normalizing your security data to ECS
The importance of normalizing your security data to ECSThe importance of normalizing your security data to ECS
The importance of normalizing your security data to ECS
 
Public sector keynote
Public sector keynotePublic sector keynote
Public sector keynote
 
Finding relevant results faster with Elasticsearch
Finding relevant results faster with ElasticsearchFinding relevant results faster with Elasticsearch
Finding relevant results faster with Elasticsearch
 
Managing the Elastic Stack at Scale
Managing the Elastic Stack at ScaleManaging the Elastic Stack at Scale
Managing the Elastic Stack at Scale
 
Breaking silos between DevOps and SecOps with Elastic
Breaking silos between DevOps and SecOps with ElasticBreaking silos between DevOps and SecOps with Elastic
Breaking silos between DevOps and SecOps with Elastic
 
How we built this: Data tiering, snapshots, and asynchronous search
How we built this: Data tiering, snapshots, and asynchronous searchHow we built this: Data tiering, snapshots, and asynchronous search
How we built this: Data tiering, snapshots, and asynchronous search
 
Automating the Elastic Stack
Automating the Elastic StackAutomating the Elastic Stack
Automating the Elastic Stack
 
From secure VPC links to SSO with Elastic Cloud
From secure VPC links to SSO with Elastic CloudFrom secure VPC links to SSO with Elastic Cloud
From secure VPC links to SSO with Elastic Cloud
 
Migrating to Elasticsearch Service on Elastic Cloud
Migrating to Elasticsearch Service on Elastic CloudMigrating to Elasticsearch Service on Elastic Cloud
Migrating to Elasticsearch Service on Elastic Cloud
 
Introduction to Visualforce for Mobile Devices
Introduction to Visualforce for Mobile DevicesIntroduction to Visualforce for Mobile Devices
Introduction to Visualforce for Mobile Devices
 
Elasticsearch: From development to production in 15 minutes
Elasticsearch: From development to production in 15 minutesElasticsearch: From development to production in 15 minutes
Elasticsearch: From development to production in 15 minutes
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
 
SIEM, malware protection, deep data visibility — for free
SIEM, malware protection, deep data visibility — for freeSIEM, malware protection, deep data visibility — for free
SIEM, malware protection, deep data visibility — for free
 
Autoscaling: From zero to production seamlessly
Autoscaling: From zero to production seamlesslyAutoscaling: From zero to production seamlessly
Autoscaling: From zero to production seamlessly
 
Streamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft AzureStreamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft Azure
 
Streamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft AzureStreamline search with Elasticsearch Service on Microsoft Azure
Streamline search with Elasticsearch Service on Microsoft Azure
 
Securing the Elastic Stack for free
Securing the Elastic Stack for freeSecuring the Elastic Stack for free
Securing the Elastic Stack for free
 
Elastic Cloud keynote
Elastic Cloud keynoteElastic Cloud keynote
Elastic Cloud keynote
 
Creating stellar customer support experiences using search
Creating stellar customer support experiences using searchCreating stellar customer support experiences using search
Creating stellar customer support experiences using search
 

More from Elasticsearch

An introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolboxAn introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolbox
Elasticsearch
 
From MSP to MSSP using Elastic
From MSP to MSSP using ElasticFrom MSP to MSSP using Elastic
From MSP to MSSP using Elastic
Elasticsearch
 
Cómo crear excelentes experiencias de búsqueda en sitios web
Cómo crear excelentes experiencias de búsqueda en sitios webCómo crear excelentes experiencias de búsqueda en sitios web
Cómo crear excelentes experiencias de búsqueda en sitios web
Elasticsearch
 
Te damos la bienvenida a una nueva forma de realizar búsquedas
Te damos la bienvenida a una nueva forma de realizar búsquedas Te damos la bienvenida a una nueva forma de realizar búsquedas
Te damos la bienvenida a una nueva forma de realizar búsquedas
Elasticsearch
 
Tirez pleinement parti d'Elastic grâce à Elastic Cloud
Tirez pleinement parti d'Elastic grâce à Elastic CloudTirez pleinement parti d'Elastic grâce à Elastic Cloud
Tirez pleinement parti d'Elastic grâce à Elastic Cloud
Elasticsearch
 
Comment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitablesComment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitables
Elasticsearch
 
Plongez au cœur de la recherche dans tous ses états.
Plongez au cœur de la recherche dans tous ses états.Plongez au cœur de la recherche dans tous ses états.
Plongez au cœur de la recherche dans tous ses états.
Elasticsearch
 
Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]
Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]
Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]
Elasticsearch
 
An introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolboxAn introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolbox
Elasticsearch
 
Welcome to a new state of find
Welcome to a new state of findWelcome to a new state of find
Welcome to a new state of find
Elasticsearch
 
Building great website search experiences
Building great website search experiencesBuilding great website search experiences
Building great website search experiences
Elasticsearch
 
Keynote: Harnessing the power of Elasticsearch for simplified search
Keynote: Harnessing the power of Elasticsearch for simplified searchKeynote: Harnessing the power of Elasticsearch for simplified search
Keynote: Harnessing the power of Elasticsearch for simplified search
Elasticsearch
 
Cómo transformar los datos en análisis con los que tomar decisiones
Cómo transformar los datos en análisis con los que tomar decisionesCómo transformar los datos en análisis con los que tomar decisiones
Cómo transformar los datos en análisis con los que tomar decisiones
Elasticsearch
 
Explore relève les défis Big Data avec Elastic Cloud
Explore relève les défis Big Data avec Elastic Cloud Explore relève les défis Big Data avec Elastic Cloud
Explore relève les défis Big Data avec Elastic Cloud
Elasticsearch
 
Comment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitablesComment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitables
Elasticsearch
 
Transforming data into actionable insights
Transforming data into actionable insightsTransforming data into actionable insights
Transforming data into actionable insights
Elasticsearch
 
Opening Keynote: Why Elastic?
Opening Keynote: Why Elastic?Opening Keynote: Why Elastic?
Opening Keynote: Why Elastic?
Elasticsearch
 
Empowering agencies using Elastic as a Service inside Government
Empowering agencies using Elastic as a Service inside GovernmentEmpowering agencies using Elastic as a Service inside Government
Empowering agencies using Elastic as a Service inside Government
Elasticsearch
 
The opportunities and challenges of data for public good
The opportunities and challenges of data for public goodThe opportunities and challenges of data for public good
The opportunities and challenges of data for public good
Elasticsearch
 
Enterprise search and unstructured data with CGI and Elastic
Enterprise search and unstructured data with CGI and ElasticEnterprise search and unstructured data with CGI and Elastic
Enterprise search and unstructured data with CGI and Elastic
Elasticsearch
 

More from Elasticsearch (20)

An introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolboxAn introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolbox
 
From MSP to MSSP using Elastic
From MSP to MSSP using ElasticFrom MSP to MSSP using Elastic
From MSP to MSSP using Elastic
 
Cómo crear excelentes experiencias de búsqueda en sitios web
Cómo crear excelentes experiencias de búsqueda en sitios webCómo crear excelentes experiencias de búsqueda en sitios web
Cómo crear excelentes experiencias de búsqueda en sitios web
 
Te damos la bienvenida a una nueva forma de realizar búsquedas
Te damos la bienvenida a una nueva forma de realizar búsquedas Te damos la bienvenida a una nueva forma de realizar búsquedas
Te damos la bienvenida a una nueva forma de realizar búsquedas
 
Tirez pleinement parti d'Elastic grâce à Elastic Cloud
Tirez pleinement parti d'Elastic grâce à Elastic CloudTirez pleinement parti d'Elastic grâce à Elastic Cloud
Tirez pleinement parti d'Elastic grâce à Elastic Cloud
 
Comment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitablesComment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitables
 
Plongez au cœur de la recherche dans tous ses états.
Plongez au cœur de la recherche dans tous ses états.Plongez au cœur de la recherche dans tous ses états.
Plongez au cœur de la recherche dans tous ses états.
 
Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]
Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]
Modernising One Legal Se@rch with Elastic Enterprise Search [Customer Story]
 
An introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolboxAn introduction to Elasticsearch's advanced relevance ranking toolbox
An introduction to Elasticsearch's advanced relevance ranking toolbox
 
Welcome to a new state of find
Welcome to a new state of findWelcome to a new state of find
Welcome to a new state of find
 
Building great website search experiences
Building great website search experiencesBuilding great website search experiences
Building great website search experiences
 
Keynote: Harnessing the power of Elasticsearch for simplified search
Keynote: Harnessing the power of Elasticsearch for simplified searchKeynote: Harnessing the power of Elasticsearch for simplified search
Keynote: Harnessing the power of Elasticsearch for simplified search
 
Cómo transformar los datos en análisis con los que tomar decisiones
Cómo transformar los datos en análisis con los que tomar decisionesCómo transformar los datos en análisis con los que tomar decisiones
Cómo transformar los datos en análisis con los que tomar decisiones
 
Explore relève les défis Big Data avec Elastic Cloud
Explore relève les défis Big Data avec Elastic Cloud Explore relève les défis Big Data avec Elastic Cloud
Explore relève les défis Big Data avec Elastic Cloud
 
Comment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitablesComment transformer vos données en informations exploitables
Comment transformer vos données en informations exploitables
 
Transforming data into actionable insights
Transforming data into actionable insightsTransforming data into actionable insights
Transforming data into actionable insights
 
Opening Keynote: Why Elastic?
Opening Keynote: Why Elastic?Opening Keynote: Why Elastic?
Opening Keynote: Why Elastic?
 
Empowering agencies using Elastic as a Service inside Government
Empowering agencies using Elastic as a Service inside GovernmentEmpowering agencies using Elastic as a Service inside Government
Empowering agencies using Elastic as a Service inside Government
 
The opportunities and challenges of data for public good
The opportunities and challenges of data for public goodThe opportunities and challenges of data for public good
The opportunities and challenges of data for public good
 
Enterprise search and unstructured data with CGI and Elastic
Enterprise search and unstructured data with CGI and ElasticEnterprise search and unstructured data with CGI and Elastic
Enterprise search and unstructured data with CGI and Elastic
 

Recently uploaded

"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
leebarnesutopia
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 

Recently uploaded (20)

"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 

Next-level integration with Spring Data Elasticsearch

  • 1. 1 ElasticON Global Peter-Josef Meisch Spring Data Elasticsearch Project Lead
  • 2. 2 This presentation and the accompanying oral presentation contain forward-looking statements, including statements concerning plans for future offerings; the expected strength, performance or benefits of our offerings; and our future operations and expected performance. These forward-looking statements are subject to the safe harbor provisions under the Private Securities Litigation Reform Act of 1995. Our expectations and beliefs in light of currently available information regarding these matters may not materialize. Actual outcomes and results may differ materially from those contemplated by these forward-looking statements due to uncertainties, risks, and changes in circumstances, including, but not limited to those related to: the impact of the COVID-19 pandemic on our business and our customers and partners; our ability to continue to deliver and improve our offerings and successfully develop new offerings, including security-related product offerings and SaaS offerings; customer acceptance and purchase of our existing offerings and new offerings, including the expansion and adoption of our SaaS offerings; our ability to realize value from investments in the business, including R&D investments; our ability to maintain and expand our user and customer base; our international expansion strategy; our ability to successfully execute our go-to-market strategy and expand in our existing markets and into new markets, and our ability to forecast customer retention and expansion; and general market, political, economic and business conditions. Additional risks and uncertainties that could cause actual outcomes and results to differ materially are included in our filings with the Securities and Exchange Commission (the “SEC”), including our Annual Report on Form 10-K for the most recent fiscal year, our quarterly report on Form 10-Q for the most recent fiscal quarter, and any subsequent reports filed with the SEC. SEC filings are available on the Investor Relations section of Elastic’s website at ir.elastic.co and the SEC’s website at www.sec.gov. Any features or functions of services or products referenced in this presentation, or in any presentations, press releases or public statements, which are not currently available or not currently available as a general availability release, may not be delivered on time or at all. The development, release, and timing of any features or functionality described for our products remains at our sole discretion. Customers who purchase our products and services should make the purchase decisions based upon services and product features and functions that are currently available. All statements are made only as of the date of the presentation, and Elastic assumes no obligation to, and does not currently intend to, update any forward-looking statements or statements relating to features or functions of services or products, except as required by law. Forward-Looking Statements
  • 3. 3 Nothing will stop you being creative more effectively as the fear of making a mistake. John Cleese
  • 5. What is Spring Data Elasticsearch?
  • 6. “Spring Data’s mission is to provide a familiar and consistent, Spring-based programming model for data access while still retaining the special traits of the underlying data store.”
  • 8. Configure the connection to Elasticsearch @Configuration public class RestClientConfig extends AbstractElasticsearchConfiguration { @Override @Bean public RestHighLevelClient elasticsearchClient() { ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo("localhost:9200") .build(); return RestClients.create(clientConfiguration).rest(); } }
  • 9. Configure the connection to Elasticsearch @Configuration public class RestClientConfig extends AbstractElasticsearchConfiguration { @Override @Bean public RestHighLevelClient elasticsearchClient() { ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo("localhost:9200") .withProxy("localhost:8080") .build(); return RestClients.create(clientConfiguration).rest(); } }
  • 10. Configure the connection to Elasticsearch @Configuration public class RestClientConfig extends AbstractElasticsearchConfiguration { @Override @Bean public RestHighLevelClient elasticsearchClient() { ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo("localhost:9200") .usingSsl() .build(); return RestClients.create(clientConfiguration).rest(); } }
  • 11. Configure the connection to Elasticsearch @Configuration public class RestClientConfig extends AbstractElasticsearchConfiguration { @Override @Bean public RestHighLevelClient elasticsearchClient() { ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo("localhost:9200") .withBasicAuth("myuser", "mypassword") .build(); return RestClients.create(clientConfiguration).rest(); } }
  • 12. Configure the connection to Elasticsearch @Configuration public class RestClientConfig extends AbstractElasticsearchConfiguration { @Override @Bean public RestHighLevelClient elasticsearchClient() { ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo("localhost:9200") .withPathPrefix("customer1") .build(); return RestClients.create(clientConfiguration).rest(); } }
  • 13. Configure the connection to Elasticsearch Supplier<HttpHeaders> currentTimeHeaders = () -> { HttpHeaders headers = new HttpHeaders(); headers.add("currentTime", LocalDateTime.now() .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); return headers; }; ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo("localhost:9200") .withHeaders(currentTimeHeaders) .build();
  • 15. Entity definition public class Person { @Id private String id; private String lastName; private String firstName; private LocalDate birthDate; }
  • 16. Entity definition @Document(indexName = "person") public class Person { @Id private String id; private String lastName; private String firstName; private LocalDate birthDate; }
  • 17. Entity definition @Document(indexName = "person") public class Person { @Id private String id; @Field(type = FieldType.Text) private String lastName; @Field(type = FieldType.Text) private String firstName; private LocalDate birthDate; }
  • 18. Entity definition @Document(indexName = "person") public class Person { @Id private String id; @Field(type = FieldType.Text) private String lastName; @Field(type = FieldType.Text) private String firstName; @Field(type = FieldType.Date, format = DateFormat.basic_date) private LocalDate birthDate; }
  • 20. IndexOperations ● index creation and deletion ● index settings ● index mappings ● index templates ● alias management ● refresh operation
  • 21. IndexOperations private ElasticsearchOperations operations ; // injected by Spring IndexOperations indexOps = operations.indexOps(Person.class); indexOps.create(); indexOps.putMapping(); PutTemplateRequest putTemplateRequest = PutTemplateRequest.builder("template-name", "log-*") .withSettings(settings) .withMappings(mapping) .withAliasActions(aliasActions) .build(); indexOps.putTemplate(putTemplateRequest);
  • 22. IndexOperations private ElasticsearchOperations operations; // injected by Spring IndexOperations indexOps = operations.indexOps(Person.class) ; indexOps.create(); indexOps.putMapping(); PutTemplateRequest putTemplateRequest = PutTemplateRequest.builder("template-name", "log-*") .withSettings(settings) .withMappings(mapping) .withAliasActions(aliasActions) .build(); indexOps.putTemplate(putTemplateRequest);
  • 23. IndexOperations private ElasticsearchOperations operations; // injected by Spring IndexOperations indexOps = operations.indexOps(Person.class); indexOps.create(); indexOps.putMapping(); PutTemplateRequest putTemplateRequest = PutTemplateRequest.builder("template-name", "log-*") .withSettings(settings) .withMappings(mapping) .withAliasActions(aliasActions) .build(); indexOps.putTemplate(putTemplateRequest);
  • 24. IndexOperations private ElasticsearchOperations operations; // injected by Spring IndexOperations indexOps = operations.indexOps(Person.class); indexOps.create(); indexOps.putMapping(); PutTemplateRequest putTemplateRequest = PutTemplateRequest.builder("template-name", "log-*") .withSettings(settings) .withMappings(mapping) .withAliasActions(aliasActions) .build(); indexOps.putTemplate(putTemplateRequest) ;
  • 25. DocumentOperations ● save ● get ● delete ● exists ● update
  • 27. NativeSearchQuery import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.search.aggregations.AggregationBuilders.*; Query query = new NativeSearchQueryBuilder() .addAggregation( terms("lastNames").field("lastName").size(10) ) .withQuery( matchQuery("firstName", firstName) ) .build(); SearchHits<Person> searchHits = operations.search(query, Person.class);
  • 28. StringQuery Query query = new StringQuery( "{" + " "bool": {" + " "must": [" + " {" + " "match": {" + " "lastName": "Smith"" + " }" + " }" + " ]" + " }" + "}"); SearchHits<Person> searchHits = operations.search(query, Person.class);
  • 29. CriteriaQuery Criteria criteria = new Criteria("lastName").is("Smith") .and("firstName").is("James"); Query query = new CriteriaQuery(criteria); SearchHits<Person> searchHits = operations.search(query, Person.class);
  • 31. SearchHit<T ● id ● index name ● the entity of type T ● score ● sort values ● highlight fields ● inner hits
  • 32. SearchHits<T ● number of total hits ● total hits relation (eq, gte) ● list of SearchHit<T> objects ● max score ● aggregations
  • 34. Repository interface PersonRepository extends ElasticsearchRepository< Person, String > { } // ElasticsearchRepository // +PagingAndSortingRepository // + CrudRepository // + Repository
  • 36. Repository methods interface PersonRepository extends ElasticsearchRepository< Person, String > { List<Person> searchByFirstName(String name); List<Person> findByFirstNameOrderByLastNameAsc(String name); List<Person> queryByBirthDateBefore(LocalDate date); }
  • 37. Repository methods interface PersonRepository extends ElasticsearchRepository<Person, String> { @Query(value = "{"fuzzy":{"lastName":"?0"}}") List<Person> findByLastNameFuzzy(String lastName); }
  • 38. Repository method return types interface PersonRepository extends ElasticsearchRepository<Person, String> { List<Person> searchByFirstName(String name); }
  • 39. Repository method return types interface PersonRepository extends ElasticsearchRepository<Person, String> { Stream<Person> searchByFirstName(String name); }
  • 40. Repository method return types interface PersonRepository extends ElasticsearchRepository<Person, String> { List<SearchHit<Person>> searchByFirstName(String name); }
  • 41. Repository method return types interface PersonRepository extends ElasticsearchRepository<Person, String> { Stream<SearchHit<Person>> searchByFirstName(String name); }
  • 42. Repository method return types interface PersonRepository extends ElasticsearchRepository<Person, String> { SearchHits<Person> searchByFirstName(String name); }
  • 43. Repository method return types interface PersonRepository extends ElasticsearchRepository<Person, String> { SearchPage<Person> searchByFirstName(String name, Pageable page); }
  • 44. Repository usage @RestController @RequestMapping(”/persons”) public class PersonController { private PersonRepository repository; public PersonController(PersonRepository repository) { this.repository = repository; } @GetMapping(”/firstName/{name}”) List<Person> byFirstName( @PathVariable(”name”) String name) { return repository.searchByFirstName(name) ; } }
  • 45. Repository method with highlight definition interface PersonRepository extends ElasticsearchRepository<Person, String> { @Highlight(fields = { @HighlightField(name = "firstName") }) SearchHits<Person> searchByFirstName(String name); } repository.searchByFirstName(”James”) .forEach(searchHit -> { List<String> highlights = searchHit.getHighlightField("firstName"); // ... });
  • 47. Lifecycle events @Component public class PersonBeforeConvertCallback implements BeforeConvertCallback<Person> { @Override public Person onBeforeConvert(Person person, IndexCoordinates indexCoordinates) { if (person.getId() == null) { person.setId(UUID.randomUUID().toString()); } return person; } }
  • 48. Auditable Entity @Document(indexName = "person") public class Person implements Persistable<String> { @Id private String id; @CreatedDate @Field(type = FieldType.Date, format = DateFormat.basic_date_time) private Instant created; @CreatedBy private String createdBy; @Override public boolean isNew() { return id == null || (createdBy == null && created == null); } }
  • 49. We need contributors! Spring Data Elasticsearch is a community-driven project