How to Create a Custom Index for an Elasticsearch Entity
Define an Elasticsearch entity in Spring Boot 3, customise its mapping and analyzers, and create the index with IndexOperations.
2,881 posts about Java: questions with answers, tutorials and articles, newest first.
Define an Elasticsearch entity in Spring Boot 3, customise its mapping and analyzers, and create the index with IndexOperations.
@Document maps a Java class to an Elasticsearch index in Spring Data. See indexName, settings, field types and a repository example.
Step-by-step Spring Boot product search with Spring Data Elasticsearch: document mapping, bulk indexing, fuzzy multi_match queries and a REST endpoint.
ElasticsearchOperations lets you index, search and manage Elasticsearch from Spring Boot. See key methods, query types and how it differs from repositories.
Set up Spring Data Elasticsearch in Spring Boot: dependency, connection settings, a @Document class, a repository interface, derived and custom queries.
This starter auto-configures the Elasticsearch Java client, repositories and ElasticsearchOperations so Spring Boot can index and search data.
Connect Spring Boot to Elasticsearch with Spring Data, map documents, query with repositories and NativeQuery, and test with Testcontainers.
RedisCacheManager is Spring's Redis-backed CacheManager. See how to configure it in Spring Boot with TTLs, JSON serialization and per-cache settings.
Step-by-step Redis repository in Spring Boot using @RedisHash, CrudRepository, secondary indexes and TTL, plus limits and when to use RedisTemplate.
Connect Spring Boot to Redis with the data-redis starter, configure Lettuce, and store strings and JSON objects with templates and TTLs.
@Endpoint registers a bean as a Spring Boot Actuator endpoint and @ReadOperation handles GET requests. Learn exposure, write and delete operations, and security.
Build a custom Spring Boot Actuator endpoint with @Endpoint, then add a health indicator, Micrometer metrics and Spring Security rules.
Add the Actuator starter, expose the endpoints you need, call them under /actuator and secure them with a SecurityFilterChain in Spring Boot 3.
Add the Actuator starter, expose health and metrics endpoints, send Micrometer metrics to Prometheus and lock the endpoints down for production.
Create a Spring bean implementing HealthIndicator to report the state of any dependency, then control exposure, grouping and timeouts through Actuator.
Add Spring Boot Actuator to get /actuator/health, then extend it with custom indicators, Kubernetes liveness and readiness probes, and Spring Security 6 rules.
OncePerRequestFilter is a Spring base class that makes sure filter logic runs only once per request, even across forwards, error and async dispatches.
Build a JWT filter with OncePerRequestFilter, validate tokens with jjwt 0.12 and register it in a stateless Spring Security 6 filter chain.
Use Spring Security's OAuth2 resource server to validate JWTs, map claims to roles and protect REST endpoints in Spring Boot 3 without a custom filter.
The JJWT Claims interface represents a JWT payload as a map with typed getters for registered claims such as subject, issuer and expiration. Learn to build and read claims safely.