# bboss-elasticsearch
**Repository Path**: phial3/bboss-elastic
## Basic Information
- **Project Name**: bboss-elasticsearch
- **Description**: the best elasticsearch highlevel java rest api-----bboss
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 113
- **Created**: 2019-09-28
- **Last Updated**: 2022-02-13
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 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,+
# 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 install
```
Gradle environmenet install and config document: https://esdoc.bbossgroups.com/#/bboss-build
# How to use Elasticsearch BBoss.
First add the maven dependency of BBoss to your pom.xml:
```xml
com.bbossgroups.plugins
bboss-elasticsearch-rest-jdbc
5.8.8
```
If it's a spring boot project, you can replace the Maven coordinate above with the following Maven coordinate:
```xml
com.bbossgroups.plugins
bboss-elasticsearch-spring-boot-starter
5.8.8
```
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:
```properties
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 last create a jsp file named testElasticsearch.jsp :
```jsp
<%@ page import="org.frameworkset.elasticsearch.ElasticSearchHelper" %>
<%@ page import="org.frameworkset.elasticsearch.client.ClientInterface" %>
<%@ page import="org.frameworkset.elasticsearch.entity.ESDatas" %>
<%@ page import="org.frameworkset.elasticsearch.scroll.ScrollHandler" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.frameworkset.common.poolman.SQLExecutor" %>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page 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