public interface EsIndexService
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addData(org.elasticsearch.action.index.IndexRequest request)
数据添加
|
boolean |
addData(String index,
Object source)
数据添加 随机esOnlyId
|
boolean |
addData(String index,
Object source,
String esOnlyId)
新增数据,自定义esOnlyId
|
boolean |
bulkPost(org.elasticsearch.action.bulk.BulkRequest bulkRequest)
批量插入
PS: false 指得是没有失败的数据
|
boolean |
bulkPost(String index,
List<Object> objects)
随机ID,批量插入
PS: false 指得是没有失败的数据
|
boolean |
bulkPostAppointId(String index,
List<Map<String,Object>> list)
指定ID,批量插入
PS: false 指得是没有失败的数据
|
boolean |
createIndex(String index)
创建索引
PS:相当于创建了一个表,一个类型的仓库
|
boolean |
createIndexMapping(String index,
List<String> fields)
创建索引库映射
index不存在会先创建,存在则会先执行删除,再创建index,最后创建字段映射
若结尾是"time",则类型为 keyword;
若结尾是 "dateFormat",则类型为 date; 若等于 "status",则类型为 integer; 若等于 "id",则类型为 integer; 若结尾是 "stats",则类型为 integer; 若结尾是 "type",则类型为 integer; |
boolean |
createIndexMapping(String index,
String field)
单个字段创建索引库映射
PS: index 必须存在,若不存在则无法创建映射。
|
boolean |
createIndexMapping(String index,
String nested,
List<String> nestedFields)
创建嵌套映射
若结尾是"time",则类型为 keyword;
若结尾是 "dateFormat",则类型为 date; 若等于 "status",则类型为 integer; 若等于 "id",则类型为 integer; 若结尾是 "stats",则类型为 integer; 若结尾是 "type",则类型为 integer; |
boolean |
deleteDataById(String index,
String esOnlyId)
通过ID删除数据
|
boolean |
deleteIndex(String index)
删除索引
|
boolean |
existsById(String index,
String esOnlyId)
通过ID判断文档是否存在
|
boolean |
isIndexExist(String index)
判断索引是否存在
|
boolean |
submitData(String index,
Object source,
String esOnlyId)
新增/更新数据
|
boolean |
submitMapping(String index,
String mapping)
创建索映射
|
boolean |
updateDataById(String index,
Object source,
String esOnlyId)
通过ID 更新数据
|
boolean |
updateDataByIdNoRealTime(String index,
Object source,
String esOnlyId)
通过ID 更新数据,保证实时性
|
boolean createIndex(String index) throws IOException
IOException - IOExceptionboolean isIndexExist(String index) throws IOException
IOException - IOExceptionboolean deleteIndex(String index) throws IOException
IOException - IOExceptionboolean createIndexMapping(String index, List<String> fields) throws Exception
index不存在会先创建,存在则会先执行删除,再创建index,最后创建字段映射
若结尾是"time",则类型为 keyword;
若结尾是 "dateFormat",则类型为 date;
若等于 "status",则类型为 integer;
若等于 "id",则类型为 integer;
若结尾是 "stats",则类型为 integer;
若结尾是 "type",则类型为 integer;
Exception - Exceptionboolean createIndexMapping(String index, String field) throws Exception
若结尾是"time",则类型为 keyword;
若结尾是 "dateFormat",则类型为 date;
若等于 "status",则类型为 integer;
若等于 "id",则类型为 integer;
若结尾是 "stats",则类型为 integer;
若结尾是 "type",则类型为 integer;
Exception - Exceptionboolean createIndexMapping(String index, String nested, List<String> nestedFields) throws Exception
若结尾是"time",则类型为 keyword;
若结尾是 "dateFormat",则类型为 date;
若等于 "status",则类型为 integer;
若等于 "id",则类型为 integer;
若结尾是 "stats",则类型为 integer;
若结尾是 "type",则类型为 integer;
Exception - Exceptionboolean submitMapping(String index, String mapping) throws IOException
IOException - Exceptionboolean submitData(String index, Object source, String esOnlyId) throws IOException
IOException - IOExceptionboolean addData(String index, Object source, String esOnlyId) throws IOException
IOException - IOExceptionboolean addData(String index, Object source) throws IOException
IOException - IOExceptionboolean addData(org.elasticsearch.action.index.IndexRequest request)
throws IOException
IOException - IOExceptionboolean deleteDataById(String index, String esOnlyId) throws IOException
IOException - IOExceptionboolean updateDataById(String index, Object source, String esOnlyId) throws IOException
IOException - IOExceptionboolean updateDataByIdNoRealTime(String index, Object source, String esOnlyId) throws IOException
IOException - IOExceptionboolean existsById(String index, String esOnlyId) throws IOException
IOException - IOExceptionboolean bulkPost(String index, List<Object> objects) throws IOException
IOException - IOExceptionboolean bulkPost(org.elasticsearch.action.bulk.BulkRequest bulkRequest)
throws IOException
IOException - IOExceptionboolean bulkPostAppointId(String index, List<Map<String,Object>> list) throws IOException
IOException - IOExceptionCopyright © 2023 tan. All rights reserved.