@Component public class ESClient extends Object
| 构造器和说明 |
|---|
ESClient() |
| 限定符和类型 | 方法和说明 |
|---|---|
<T> org.elasticsearch.action.bulk.BulkResponse |
bulkCreateDocument(String index,
List<Pair<String,T>> dataList)
批量插入,
|
org.elasticsearch.action.bulk.BulkResponse |
bulkDeleteDocument(String index,
String type,
List<String> idList)
批量删除
|
org.elasticsearch.action.index.IndexResponse |
createDocument(String index,
String jsonString)
创建文档
|
org.elasticsearch.action.index.IndexResponse |
createDocument(String index,
String type,
String id,
String jsonString)
创建文档 指定id
|
org.elasticsearch.action.admin.indices.create.CreateIndexResponse |
createIndex(String index,
String jsonMapping)
创建索引
|
boolean |
createIndex(String index,
String type,
org.elasticsearch.common.settings.Settings.Builder settings,
org.elasticsearch.common.xcontent.XContentBuilder mappings)
创建索引库
|
boolean |
deleteDocument(String index,
String type,
String id)
删除文档
|
boolean |
deleteIndex(String index)
删除索引库
|
String |
getDocument(String index,
String type,
String id)
获取文档
|
org.elasticsearch.action.search.SearchResponse |
searchDocuments(String index,
org.elasticsearch.search.builder.SearchSourceBuilder query)
查询文档
|
org.elasticsearch.action.update.UpdateResponse |
updateDocument(String index,
String type,
String id,
String jsonString)
更新文档
|
public boolean createIndex(String index, String type, org.elasticsearch.common.settings.Settings.Builder settings, org.elasticsearch.common.xcontent.XContentBuilder mappings) throws IOException
index - 索引名type - 映射类型settings - 设置的分片,备份分片数量mappings - 索引库的结构IOExceptionpublic org.elasticsearch.action.admin.indices.create.CreateIndexResponse createIndex(String index, String jsonMapping) throws IOException
index - jsonMapping - 索引库结构IOExceptionpublic boolean deleteIndex(String index) throws IOException
index - 索引库名IOExceptionpublic org.elasticsearch.action.index.IndexResponse createDocument(String index, String type, String id, String jsonString) throws IOException
index - 索引id - 文档idjsonString - 文档内容IOExceptionpublic org.elasticsearch.action.index.IndexResponse createDocument(String index, String jsonString) throws IOException
index - 索引jsonString - 文档内容IOExceptionpublic String getDocument(String index, String type, String id) throws IOException
index - 索引库id - 文档idIOExceptionpublic boolean deleteDocument(String index, String type, String id) throws IOException
index - 索引库名id - 文档idIOExceptionpublic org.elasticsearch.action.update.UpdateResponse updateDocument(String index, String type, String id, String jsonString) throws IOException
index - 索引库名称id - 文档idjsonString - 更新的内容IOExceptionpublic org.elasticsearch.action.search.SearchResponse searchDocuments(String index, org.elasticsearch.search.builder.SearchSourceBuilder query) throws IOException
index - 索引库query - 查询条件IOExceptionpublic <T> org.elasticsearch.action.bulk.BulkResponse bulkCreateDocument(String index, List<Pair<String,T>> dataList) throws IOException
index - 索引库名dataList - IOExceptionpublic org.elasticsearch.action.bulk.BulkResponse bulkDeleteDocument(String index, String type, List<String> idList) throws IOException
index - 索引库名idList - 需要删除的文档idIOExceptionCopyright © 2025. All rights reserved.