The best elasticsearch highlevel java rest api-----bboss
ElasticSearch客户端框架bboss的ClientInterface 接口提供了创建/修改、获取、删除索引Indice和IndexTemplate的方法,本文举例说明其使用方法。
1 准备工作
参考文档在项目中导入Elasticsearch客户端:集成Elasticsearch Restful API案例分享
本文除了介绍索引Indice和Index Template的创建修改方法,还可以看到如何在dsl中添加注释的用法:
单行注释
## 注释内容
多行注释
#*
。。。。注释内容
。。。
*#
更多bboss dsl配置和定义的内容,参考文档:高性能elasticsearch ORM开发库使用介绍 章节【5.3 配置es查询dsl脚本语法】
2 定义创建Indice的dsl脚本
在配置文件-esmapper/demo.xml中定义一个名称为createDemoIndice的dsl脚本:
<!--
创建demo需要的索引表结构
-->
<property name="createDemoIndice">
<![CDATA[{
"settings": {
"number_of_shards": 6,
"index.refresh_i