xiangpei
3 天以前 2f68e5600f0b60d6f8d170f4536e1fc410662ea7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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);
 
}