Skip to content

blaspat/elasticsearchclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resilient Elasticsearch Client

A resilient Elasticsearch client for Java applications with connection pooling, thread-safe client management, and configurable timeouts.

Maven Central

Maven

<dependency>
    <groupId>io.github.blaspat</groupId>
    <artifactId>elasticsearchclient</artifactId>
    <version>1.0.4</version>
</dependency>

Features

  • Thread-safe client pool — Uses ConcurrentHashMap for safe concurrent access
  • Connection pooling — Configurable number of initial connections
  • Round-robin load balancing — Clients are selected using atomic round-robin
  • Configurable timeouts — Connection and socket timeouts via properties
  • Graceful shutdown — All clients are properly closed via @PreDestroy

Configuration

elasticsearch:
  hosts: localhost:9200
  scheme: https
  username: elastic
  password: password
  connection:
    initConnections: 3
    connectTimeout: 5000
    socketTimeout: 30000

Usage

@Autowired
private ElasticsearchClientConfig elasticsearchClientConfig;

public void search() {
    ElasticsearchClient client = elasticsearchClientConfig.client();
    // use the client
}

Notes

  • ⚠️ SSL certificate verification is disabled — this library trusts all certificates. Do NOT use in production without proper certificate management.
  • Clients are properly closed on application shutdown via @PreDestroy.

About

Elasticsearch Simple Client

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages