Package io.vertx.tp.plugin.elasticsearch
Interface ElasticSearchClient
- All Known Implementing Classes:
ElasticSearchClientImpl
public interface ElasticSearchClient
- Since:
- 2019/12/29, 13:27
- Author:
- Hongwei
-
Method Summary
Modifier and TypeMethodDescriptionbooleanio.vertx.core.json.JsonObjectcreateDocument(String index, String documentId, io.vertx.core.json.JsonObject source) create document from json object, must specify document idcreateDocuments(String index, io.vertx.core.json.JsonArray documents) createDocuments(String index, io.vertx.core.json.JsonArray documents, String keyField) io.vertx.core.json.JsonObjectcreateIndex(String index, int numberOfShards, int numberOfReplicas, ConcurrentMap<String, Class<?>> mappings) create index with settings and mappingsio.vertx.core.json.JsonObjectcreateIndex(String index, ConcurrentMap<String, Class<?>> mappings) static ElasticSearchClientcreateShared(io.vertx.core.Vertx vertx, io.vertx.core.json.JsonObject options) io.vertx.core.json.JsonObjectdeleteDocument(String index, String documentId) delete document by document iddeleteDocuments(String index, Set<String> ids) io.vertx.core.json.JsonObjectdeleteIndex(String index) delete index by nameio.vertx.core.json.JsonObjectgetDocument(String index, String documentId) get document by document idio.vertx.core.json.JsonObjectget index informationio.vertx.core.json.JsonObjectsearch(io.vertx.core.json.JsonObject params) get search result from ElasticSearch by search textio.vertx.core.json.JsonObjectsearch(io.vertx.core.json.JsonObject params, ConcurrentMap<String, String> precisionMap) io.vertx.core.json.JsonObjectupdateDocument(String index, String documentId, io.vertx.core.json.JsonObject source) update document from json object, must specify document idupdateDocuments(String index, io.vertx.core.json.JsonArray documents) updateDocuments(String index, io.vertx.core.json.JsonArray documents, String keyField) io.vertx.core.json.JsonObjectupdateIndex(String index) io.vertx.core.json.JsonObjectupdateIndex(String index, int numberOfShards, int numberOfReplicas) delete index
-
Method Details
-
connected
boolean connected() -
getIndex
get index information- Parameters:
index- name of index- Returns:
- JsonObject for index information
-
createIndex
io.vertx.core.json.JsonObject createIndex(String index, int numberOfShards, int numberOfReplicas, ConcurrentMap<String, Class<?>> mappings) create index with settings and mappings- Parameters:
index- name of index. this is real index namenumberOfShards- number of shards, default is 3numberOfReplicas- number of replicas, default is 2mappings- fields were used to create index mapping- Returns:
- JsonObject like below { "isAcknowledged": true }
-
createIndex
-
updateIndex
delete index- Parameters:
index- name of indexnumberOfShards- number of shardsnumberOfReplicas- number of replicas- Returns:
- JsonObject like below { "isAcknowledged": true }
-
updateIndex
-
deleteIndex
delete index by name- Parameters:
index- name of index- Returns:
- JsonObject like below { "isAcknowledged": true }
-
getDocument
get document by document id- Parameters:
index- name of indexdocumentId- document id- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false, "data": {} }
-
createDocument
io.vertx.core.json.JsonObject createDocument(String index, String documentId, io.vertx.core.json.JsonObject source) create document from json object, must specify document id- Parameters:
index- name of indexdocumentId- document idsource- json object of document- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false }
-
createDocuments
-
createDocuments
-
updateDocument
io.vertx.core.json.JsonObject updateDocument(String index, String documentId, io.vertx.core.json.JsonObject source) update document from json object, must specify document id- Parameters:
index- name of indexdocumentId- document idsource- json object of document- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false }
-
updateDocuments
-
updateDocuments
-
deleteDocument
delete document by document id- Parameters:
index- name of indexdocumentId- document id- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false }
-
deleteDocuments
-
search
io.vertx.core.json.JsonObject search(io.vertx.core.json.JsonObject params) get search result from ElasticSearch by search text- Parameters:
params- params will be used to search, format likes below { "index": "", --- required "searchText": "", --- required "from": 0, --- default is 0 "size": 10 --- default is 10 }- Returns:
- JsonObject like below { "status": "OK", "took": 1, "aggregations": [ { "key": "cmdb", "doc_count": 10 }, ... ], "total": 10, "hits": [ { "_index": "aaa", "_type": "_doc", "_id": "2", "_score": 1.1507283, "_source": {}, "highlight": {} }, ... ] }
-
search
io.vertx.core.json.JsonObject search(io.vertx.core.json.JsonObject params, ConcurrentMap<String, String> precisionMap)