All Projects → guzhandong → spring-boot-starter-elasticsearchHighLevelClient

guzhandong / spring-boot-starter-elasticsearchHighLevelClient

Licence: other
提供elasticsearch-rest-high-level-client连接池功能,同时对接spring-boot-starter

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to spring-boot-starter-elasticsearchHighLevelClient

elastic-crud
Simple yet elegant ElasticSearch Crud Repository.
Stars: ✭ 46 (-19.3%)
Mutual labels:  elasticsearch-client, elasticsearch6
Chewy
High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
Stars: ✭ 1,749 (+2968.42%)
Mutual labels:  elasticsearch-client
Elasticsearch Hq
Monitoring and Management Web Application for ElasticSearch instances and clusters.
Stars: ✭ 4,832 (+8377.19%)
Mutual labels:  elasticsearch-client
elastic-go
A command-line tool to query the Elasticsearch REST API
Stars: ✭ 17 (-70.18%)
Mutual labels:  elasticsearch-client
snap
An Elasticsearch client for Elixir
Stars: ✭ 26 (-54.39%)
Mutual labels:  elasticsearch-client
appbase-swift
Swift Library for appbase.io and ElasticSearch
Stars: ✭ 24 (-57.89%)
Mutual labels:  elasticsearch-client
gatsby-wiki
Creating a Knowledgbase using Gatsby.js and React.js (see final product ->
Stars: ✭ 32 (-43.86%)
Mutual labels:  elasticsearch-client
VaporElasticsearch
A Vapor/Swift Elasticsearch client
Stars: ✭ 26 (-54.39%)
Mutual labels:  elasticsearch-client
elasticlient
C++ Elasticsearch client library
Stars: ✭ 112 (+96.49%)
Mutual labels:  elasticsearch-client
wES
wES is set of open source Java ElasticSearch client and toolkits; Compact, yet highly customizable and powerful.
Stars: ✭ 27 (-52.63%)
Mutual labels:  elasticsearch-client

spring-boot-starter-elasticsearchHighLevelClient

封装elasticsearch-rest-high-level-client,添加了连接池功能(官方包中没有提供连接池);同时对接spring-boot-starter

author : guzhandong

email : [email protected]

springboot version : 2.0.2.RELEASE

quickstart

install project for maven

git pull [email protected]:guzhandong/spring-boot-starter-elasticsearchHighLevelClient.git
cd spring-boot-starter-elasticsearchHighLevelClient
mvn clean install

add dependent property in pom.xml

<dependency>
    <groupId>com.guzhandong.springframework.boot</groupId>
    <artifactId>spring-boot-starter-elasticsearchRestHighLeavelClient</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

add property in application.yml

spring:
  es:
    hosts: 192.168.100.1,192.168.100.2

create java file




import com.guzhandong.springframework.boot.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.IOException;

@Repository
public class Test {

    @Autowired
    private RestHighLevelClient restHighLevelClient;

    public void test() throws IOException {
        /**
         * 同步方法直接使用
         */
        restHighLevelClient.ping();


        /**
         * 异步方法需要释放client
         */
        restHighLevelClient.getLowLevelClient();
        //异步使用完成后主动释放client
        restHighLevelClient.releaseClient();


        /**
         * 执行多条异步操作,最后释放client 即可
         */
        restHighLevelClient.getLowLevelClient();
        restHighLevelClient.getLowLevelClient();
        restHighLevelClient.getLowLevelClient();
        //最后调用释放即可
        //因为在异步操作的时候,如果发现当前线程有持有的client 会先释放再重新从资源池中获取一个client 进行调用
        restHighLevelClient.releaseClient();
    }
}

all configuration

spring:
  es:
    hosts: 192.168.100.1:9200,192.168.100.2:9200
  pool:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].