Package io.vertx.tp.plugin.elasticsearch
Class ElasticSearchClientImpl
- java.lang.Object
-
- io.vertx.tp.plugin.elasticsearch.ElasticSearchClientImpl
-
- All Implemented Interfaces:
ElasticSearchClient
public class ElasticSearchClientImpl extends Object implements ElasticSearchClient
- Since:
- 2019/12/29, 13:31
- Author:
- Hongwei
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconnected()io.vertx.core.json.JsonObjectcreateDocument(String index, String documentId, io.vertx.core.json.JsonObject source)create document from json object, must specify document idBooleancreateDocuments(String index, io.vertx.core.json.JsonArray documents)BooleancreateDocuments(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)io.vertx.core.json.JsonObjectdeleteDocument(String index, String documentId)delete document by document idBooleandeleteDocuments(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.JsonObjectgetIndex(String index)get 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 idBooleanupdateDocuments(String index, io.vertx.core.json.JsonArray documents)BooleanupdateDocuments(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 Detail
-
connected
public boolean connected()
- Specified by:
connectedin interfaceElasticSearchClient
-
getIndex
public io.vertx.core.json.JsonObject getIndex(String index)
Description copied from interface:ElasticSearchClientget index information- Specified by:
getIndexin interfaceElasticSearchClient- Parameters:
index- name of index- Returns:
- JsonObject for index information
-
deleteIndex
public io.vertx.core.json.JsonObject deleteIndex(String index)
Description copied from interface:ElasticSearchClientdelete index by name- Specified by:
deleteIndexin interfaceElasticSearchClient- Parameters:
index- name of index- Returns:
- JsonObject like below { "isAcknowledged": true }
-
createIndex
public io.vertx.core.json.JsonObject createIndex(String index, ConcurrentMap<String,Class<?>> mappings)
- Specified by:
createIndexin interfaceElasticSearchClient
-
createIndex
public io.vertx.core.json.JsonObject createIndex(String index, int numberOfShards, int numberOfReplicas, ConcurrentMap<String,Class<?>> mappings)
Description copied from interface:ElasticSearchClientcreate index with settings and mappings- Specified by:
createIndexin interfaceElasticSearchClient- 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 }
-
updateIndex
public io.vertx.core.json.JsonObject updateIndex(String index)
- Specified by:
updateIndexin interfaceElasticSearchClient
-
updateIndex
public io.vertx.core.json.JsonObject updateIndex(String index, int numberOfShards, int numberOfReplicas)
Description copied from interface:ElasticSearchClientdelete index- Specified by:
updateIndexin interfaceElasticSearchClient- Parameters:
index- name of indexnumberOfShards- number of shardsnumberOfReplicas- number of replicas- Returns:
- JsonObject like below { "isAcknowledged": true }
-
createDocument
public io.vertx.core.json.JsonObject createDocument(String index, String documentId, io.vertx.core.json.JsonObject source)
Description copied from interface:ElasticSearchClientcreate document from json object, must specify document id- Specified by:
createDocumentin interfaceElasticSearchClient- Parameters:
index- name of indexdocumentId- document idsource- json object of document- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false }
-
createDocuments
public Boolean createDocuments(String index, io.vertx.core.json.JsonArray documents)
- Specified by:
createDocumentsin interfaceElasticSearchClient
-
createDocuments
public Boolean createDocuments(String index, io.vertx.core.json.JsonArray documents, String keyField)
- Specified by:
createDocumentsin interfaceElasticSearchClient
-
getDocument
public io.vertx.core.json.JsonObject getDocument(String index, String documentId)
Description copied from interface:ElasticSearchClientget document by document id- Specified by:
getDocumentin interfaceElasticSearchClient- Parameters:
index- name of indexdocumentId- document id- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false, "data": {} }
-
updateDocument
public io.vertx.core.json.JsonObject updateDocument(String index, String documentId, io.vertx.core.json.JsonObject source)
Description copied from interface:ElasticSearchClientupdate document from json object, must specify document id- Specified by:
updateDocumentin interfaceElasticSearchClient- Parameters:
index- name of indexdocumentId- document idsource- json object of document- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false }
-
updateDocuments
public Boolean updateDocuments(String index, io.vertx.core.json.JsonArray documents)
- Specified by:
updateDocumentsin interfaceElasticSearchClient
-
updateDocuments
public Boolean updateDocuments(String index, io.vertx.core.json.JsonArray documents, String keyField)
- Specified by:
updateDocumentsin interfaceElasticSearchClient
-
deleteDocument
public io.vertx.core.json.JsonObject deleteDocument(String index, String documentId)
Description copied from interface:ElasticSearchClientdelete document by document id- Specified by:
deleteDocumentin interfaceElasticSearchClient- Parameters:
index- name of indexdocumentId- document id- Returns:
- JsonObject like below { "index"; "", "id": "", "result": true / false }
-
deleteDocuments
public Boolean deleteDocuments(String index, Set<String> ids)
- Specified by:
deleteDocumentsin interfaceElasticSearchClient
-
search
public io.vertx.core.json.JsonObject search(io.vertx.core.json.JsonObject params)
Description copied from interface:ElasticSearchClientget search result from ElasticSearch by search text- Specified by:
searchin interfaceElasticSearchClient- 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
public io.vertx.core.json.JsonObject search(io.vertx.core.json.JsonObject params, ConcurrentMap<String,String> precisionMap)- Specified by:
searchin interfaceElasticSearchClient
-
-