package cn.lili.modules.lmk.service;
|
|
import java.util.Map;
|
|
/**
|
* es处理
|
*
|
* @author:xp
|
* @date:2025/6/30 14:47
|
*/
|
public interface EsService {
|
|
/**
|
* 获取索引的完整名称
|
*
|
* @param indexName
|
* @return
|
*/
|
String getIndexFullName(String indexName);
|
|
/**
|
* 创建索引
|
*
|
* @param indexName 索引名称
|
* @param mappingJsonPath json文件位置,相对于resource目录,例如:/es/video.json
|
*/
|
void createIndex(String indexName, String mappingJsonPath);
|
|
/**
|
* 重建索引,并重新添加索引数据
|
*
|
* @param indexName 索引名称
|
* @param mappingJsonPath json文件位置,相对于resource目录,例如:/es/video.json
|
*/
|
void recreateIndex(String indexName, String mappingJsonPath);
|
|
/**
|
* 添加/修改 文档,如果是修改,则是整条数据更新
|
*
|
* @param data 数据对象
|
*/
|
void addOrUpdateDocument(Object data);
|
|
/**
|
* 更新某些字段的值
|
*
|
* @param indexName 索引名称
|
* @param id 数据id
|
* @param updateList 更新哪些字段,key 字段 value要修改的值
|
*/
|
void updateSomeField(String indexName, String id, Map<String, Object> updateList);
|
|
/**
|
* 删除文档
|
* @param indexName 索引名称
|
* @param id es主键,可传业务主键
|
*/
|
void deleteDocument(String indexName, String id);
|
|
/**
|
* 索引是否存在
|
*
|
* @param indexName
|
* @return
|
*/
|
boolean indexExist(String indexName);
|
|
}
|