https://github.com/codelibs/fesen-httpclient
HTTP Rest Client for Elasticsearch and OpenSearch
https://github.com/codelibs/fesen-httpclient
elasticsearch java opensearch
Last synced: 2 months ago
JSON representation
HTTP Rest Client for Elasticsearch and OpenSearch
- Host: GitHub
- URL: https://github.com/codelibs/fesen-httpclient
- Owner: codelibs
- License: apache-2.0
- Created: 2021-01-23T00:42:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-30T13:09:36.000Z (3 months ago)
- Last Synced: 2025-03-30T14:22:23.593Z (3 months ago)
- Topics: elasticsearch, java, opensearch
- Language: Java
- Homepage:
- Size: 481 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Fesen HttpClient
[](https://github.com/codelibs/fesen-httpclient/actions/workflows/maven.yml)
====================Fesen HttpClient is HTTP Rest Client for Elasticsearch/OpenSearch.
HttpClient provided by fesen-httpclient is HTTP-based implementation for org.opensearch.client.Client.
This HttpClient supports Elasticsearch 7.x, 8.x and OpenSearch 1.x, 2.x.Usage
=====## For Maven
```
org.codelibs.fesen.client
fesen-httpclient
2.2.0```
## Example Code
```
// create client
final String host = "http://localhost:9200";
final Settings settings = Settings.builder().putList("http.hosts", host).put("http.compression", true).build();
final HttpClient client = new HttpClient(settings, null);// search
client.prepareSearch("testindex").setQuery(QueryBuilders.matchAllQuery()).execute(wrap(res -> {
final long totalHits = res.getHits().getTotalHits().value;
// ...
}, e -> {
// ...
}));
```For the more details, see test code in [src/test/java](https://github.com/codelibs/fesen-httpclient/tree/main/src/test/java/org/codelibs/fesen/client).