bboss-elasticsearch

bboss elasticsearch client with restful and java api without elasticsearch jar dependended.

License

License

Categories

Categories

Search Business Logic Libraries Elasticsearch
GroupId

GroupId

com.bbossgroups.plugins
ArtifactId

ArtifactId

bboss-elasticsearch
Last Version

Last Version

6.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

bboss-elasticsearch
bboss elasticsearch client with restful and java api without elasticsearch jar dependended.
Project URL

Project URL

http://esdoc.bbossgroups.com
Source Code Management

Source Code Management

https://github.com/bbossgroups/bboss-elasticsearch

Download bboss-elasticsearch

How to add to project

<!-- https://jarcasting.com/artifacts/com.bbossgroups.plugins/bboss-elasticsearch/ -->
<dependency>
    <groupId>com.bbossgroups.plugins</groupId>
    <artifactId>bboss-elasticsearch</artifactId>
    <version>6.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.bbossgroups.plugins/bboss-elasticsearch/
implementation 'com.bbossgroups.plugins:bboss-elasticsearch:6.2.0'
// https://jarcasting.com/artifacts/com.bbossgroups.plugins/bboss-elasticsearch/
implementation ("com.bbossgroups.plugins:bboss-elasticsearch:6.2.0")
'com.bbossgroups.plugins:bboss-elasticsearch:jar:6.2.0'
<dependency org="com.bbossgroups.plugins" name="bboss-elasticsearch" rev="6.2.0">
  <artifact name="bboss-elasticsearch" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.bbossgroups.plugins', module='bboss-elasticsearch', version='6.2.0')
)
libraryDependencies += "com.bbossgroups.plugins" % "bboss-elasticsearch" % "6.2.0"
[com.bbossgroups.plugins/bboss-elasticsearch "6.2.0"]

Dependencies

compile (12)

Group / Artifact Type Version
com.bbossgroups.plugins : bboss-elasticsearch-rest jar 6.2.0
org.elasticsearch : elasticsearch jar 6.3.2
org.elasticsearch.client : x-pack-transport jar 6.3.2
com.unboundid : unboundid-ldapsdk jar 3.2.0
org.bouncycastle : bcprov-jdk15on jar 1.58
org.bouncycastle : bcpkix-jdk15on jar 1.58
com.google.code.gson : gson jar 2.2.2
com.google.guava : guava jar 11.0.2
org.apache.logging.log4j : log4j-slf4j-impl jar 2.8.2
org.apache.logging.log4j : log4j-api jar 2.8.2
org.apache.logging.log4j : log4j-core jar 2.8.2
org.slf4j : slf4j-api jar 1.7.25

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-all jar 1.9.0

Project Modules

There are no modules declared in this project.

Elasticsearch Bboss

Bboss is a good elasticsearch Java rest client. It operates and accesses elasticsearch in a way similar to mybatis.

https://esdoc.bbossgroups.com/#/README

Environmental requirements

JDK requirement: JDK 1.7+

Elasticsearch version requirements: 1.X,2.X,5.X,6.X,7.x,+

Spring booter 1.x,2.x,+

bboss兼容性

bboss Elasticsearch spring boot
all 1.x 1.x,2.x
all 2.x 1.x,2.x
all 3.x 1.x,2.x
all 5.x 1.x,2.x
all 6.x 1.x,2.x
all 7.x 1.x,2.x

快速开始bboss

https://esdoc.bbossgroups.com/#/quickstart

Build from source code

First Get source code from https://github.com/bbossgroups/bboss-elasticsearch

Then change to cmd window under directory bboss-elasticsearch and run gradle build command:

gradle publishToMavenLocal

Build from source code guide:

https://esdoc.bbossgroups.com/#/bboss-build

How to use Elasticsearch BBoss.

First add the maven dependency of BBoss to your pom.xml:

       <dependency>
            <groupId>com.bbossgroups.plugins</groupId>
            <artifactId>bboss-elasticsearch-rest-jdbc</artifactId>
            <version>6.2.9</version>
        </dependency>

If it's a spring boot project, you can replace the Maven coordinate above with the following Maven coordinate:

        <dependency>
            <groupId>com.bbossgroups.plugins</groupId>
            <artifactId>bboss-elasticsearch-spring-boot-starter</artifactId>
            <version>6.2.9</version>
        </dependency>

Next, add the Elasticsearch addresses to the application.properties file under the project resource directory, and create a new one if the file does not exist:

elasticsearch.rest.hostNames=10.21.20.168:9200

#Cluster addresses are separated by commas

#elasticsearch.rest.hostNames=10.180.211.27:9200,10.180.211.28:9200,10.180.211.29:9200

And write java code to test bboss api:

import org.frameworkset.elasticsearch.ElasticSearchHelper;
import org.frameworkset.elasticsearch.client.ClientInterface;
import org.frameworkset.elasticsearch.entity.ESDatas;
import org.frameworkset.elasticsearch.scroll.ScrollHandler;
import java.util.List;
import java.util.Map;
import com.frameworkset.common.poolman.SQLExecutor;

import org.frameworkset.elasticsearch.scroll.HandlerInfo;
 
	ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
	//get elasticsearch cluster state
	String result = clientUtil.executeHttp("_cluster/state?pretty",ClientInterface.HTTP_GET);

	//check indice twitter and index type tweet exist or not.
	boolean exist1 = clientUtil.existIndiceType("twitter","tweet");
	out.println("twitter  tweet type exist:"+exist1);
	//check indice twitter exist or not
	exist1 = clientUtil.existIndice("twitter");
	out.println("twitter exist:"+exist1);
	//count documents in indice twitter
	long count = clientUtil.countAll("twitter");
	out.println(count);

	//Get All documents of indice twitter,DEFAULT_FETCHSIZE is 5000
	ESDatas<Map> esDatas = clientUtil.searchAll("twitter", Map.class);

	//Get All documents of indice twitter,Set fetchsize to 10000, Using ScrollHandler to process each batch of datas.
	clientUtil.searchAll("twitter",10000,new ScrollHandler<Map>() {
		public void handle(ESDatas<Map> esDatas, HandlerInfo handlerInfo) throws Exception {
			List<Map> dataList = esDatas.getDatas();
			System.out.println("TotalSize:"+esDatas.getTotalSize());
			if(dataList != null) {
				System.out.println("dataList.size:" + dataList.size());
			}
			else
			{
				System.out.println("dataList.size:0");
			}
			//do something other such as do a db query.
			//SQLExecutor.queryList(Map.class,"select * from td_sm_user");
		}
	},Map.class);
    //Use slice parallel scoll query all documents of indice  twitter by 2 thread tasks. DEFAULT_FETCHSIZE is 5000
	//You can also use ScrollHandler to process each batch of datas on your own.
	esDatas = clientUtil.searchAllParallel("twitter", Map.class,2);
	

Elasticsearch Java Demos

The following Demo and related documentation is compatible with Elasticsearch 1.x,2.X,5.X,6.X,+ versions

Elasticsearch demo for Java project:

https://github.com/bbossgroups/elasticsearch-example

Elasticsearch demo for spring booter 1.x,2.x

https://github.com/bbossgroups/es_bboss_web

https://github.com/bbossgroups/elasticsearch-springboot-example

Fast integration bboss documentation

Spring boot integration ElasticSearch case sharing

Quickly integrate Elasticsearch Restful API case sharing

Quick Start

Elasticsearch BBoss Developer Tutorial

High-performance elasticsearch ORM library bboss use introduction

Elasticsearch技术交流群:166471282

Elasticsearch微信公众号:bbossgroup

GitHub Logo

License

The BBoss Framework is released under version 2.0 of the Apache License.

com.bbossgroups.plugins

bbossgroups

Versions

Version
6.2.0
6.1.8
6.1.7
6.1.6
6.1.5
6.1.3
6.1.2
6.1.1
6.1.0
6.0.9
6.0.8
6.0.7
6.0.6
6.0.5
6.0.3
6.0.2
6.0.1
6.0.0
5.9.9
5.9.8
5.9.7
5.9.6
5.9.5
5.9.3
5.9.2
5.9.1
5.9.0
5.8.9
5.8.8
5.8.7
5.8.6
5.8.5
5.8.3
5.8.2
5.8.1
5.8.0
5.7.9
5.7.8
5.7.7
5.7.6
5.7.5
5.7.3
5.7.2
5.7.1
5.7.0
5.6.9
5.6.8
5.6.7
5.6.6
5.6.5
5.6.3
5.6.2
5.6.1
5.6.0
5.5.9
5.5.8
5.5.7
5.5.6
5.5.5
5.5.3
5.5.2
5.5.1
5.5.0
5.3.9
5.3.8
5.3.7
5.3.6
5.3.5
5.3.3
5.3.2
5.3.1
5.3.0
5.2.9
5.2.8
5.2.7
5.2.6
5.2.5
5.2.3
5.2.2
5.2.1
5.2.0
5.1.9
5.1.8
5.1.7
5.1.6
5.1.5
5.1.3
5.1.2
5.1.1
5.1.0
5.0.9.9
5.0.9.8
5.0.9.7
5.0.9.6
5.0.9.5
5.0.9.3
5.0.9.2
5.0.9.1
5.0.9.0
5.0.8.9
5.0.8.8
5.0.8.7
5.0.8.6
5.0.8.5
5.0.8.3
5.0.8.2
5.0.8.1
5.0.8.0
5.0.7.9
5.0.7.8
5.0.7.7
5.0.7.6
5.0.7.5
5.0.7.3
5.0.7.2
5.0.7.1
5.0.7.0
5.0.6.9
5.0.6.8
5.0.6.7
5.0.6.6
5.0.6.5
5.0.6.3
5.0.6.2
5.0.6.1
5.0.6.0
5.0.5.9
5.0.5.8
5.0.5.7
5.0.5.6
5.0.5.5
5.0.5.4
5.0.5.3
5.0.5.2
5.0.5.1
5.0.5.0
5.0.3.9.6
5.0.3.9.5
5.0.3.9.3
5.0.3.9.2
5.0.3.9.1
5.0.3.9.0
5.0.3.8.9
5.0.3.8.8
5.0.3.8.7
5.0.3.8.6
5.0.3.8.5
5.0.3.8.4
5.0.3.8.3
5.0.3.8.2
5.0.3.8.1
5.0.3.8
5.0.3.7.9
5.0.3.7.8
5.0.3.7.7
5.0.3.7.6
5.0.3.7.5
5.0.3.7.4