public class ElasticSearchHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
SECURITY_FIELD |
static String |
STOPWORDS_FILENAME |
| Constructor and Description |
|---|
ElasticSearchHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
allCollectionsOfIndexElasticSearch(org.elasticsearch.client.Client client,
String indexName) |
static Set<String> |
allLanguagesOfIndexElasticSearch(org.elasticsearch.client.Client client,
String indexName,
String collection) |
static void |
clearIndex(org.elasticsearch.client.Client client,
String indexName,
String indexTypeName) |
static Long |
collectionDocumentsCountElasticSearch(org.elasticsearch.client.Client client,
String indexName,
String collectionID) |
static Boolean |
collectionExists(org.elasticsearch.client.Client client,
String indexName,
String collID) |
static void |
commit(org.elasticsearch.client.Client client,
String indexName) |
static String[] |
createFetchSourceArray(List<String> projections) |
static org.elasticsearch.common.xcontent.XContentBuilder |
createJSONObject(Map<String,? extends Object> keyValues) |
static boolean |
delete(org.elasticsearch.client.Client client,
String indexName) |
static boolean |
deleteAllIndices(org.elasticsearch.client.Client client) |
static Boolean |
deleteCollection(org.elasticsearch.client.Client client,
String indexName,
String collID) |
static Boolean |
deleteCollections(org.elasticsearch.client.Client client,
String indexName,
Collection<String> colls) |
static boolean |
deleteDocuments(org.elasticsearch.client.Client client,
String indexName,
List<String> docIDs) |
static boolean |
exists(org.elasticsearch.client.Client indexClient,
String indexName) |
static Set<String> |
getAllCollectionsOfIndex(org.elasticsearch.client.Client client,
String indexName) |
static Set<String> |
getIndexTypesByCollectionID(Map<String,Set<String>> indexTypesByCollIDs,
String collID,
org.elasticsearch.client.Client client,
String indexName) |
static Set<String> |
getIndexTypesByCollectionIDNoCache(String collID,
org.elasticsearch.client.Client client,
String indexName) |
static Set<String> |
getIndexTypesByCollectionIDs(Map<String,Set<String>> indexTypesByCollIDs,
Set<String> collIDs,
org.elasticsearch.client.Client client,
String indexName) |
static Set<String> |
getIndicesOfAlias(org.elasticsearch.client.Client client,
String alias) |
static Set<String> |
getLanguagesOfCollection(org.elasticsearch.client.Client client,
String indexName,
String collection) |
static List<org.elasticsearch.action.get.MultiGetItemResponse> |
getMultipleDocuments(org.elasticsearch.client.Client client,
Set<String> indices,
Collection<String> docIDs) |
static List<org.elasticsearch.action.get.MultiGetItemResponse> |
getMultipleDocumentsOfAlias(org.elasticsearch.client.Client client,
String alias,
Collection<String> docIDs) |
static org.elasticsearch.action.search.SearchResponse |
getNextSearchResponse(org.elasticsearch.client.Client client,
org.elasticsearch.action.search.SearchResponse scrollResponse) |
static Set<String> |
indicesOfCollection(org.elasticsearch.client.Client client,
String indexName,
String collID) |
static void |
insertBulk(org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest,
String jsonDoc,
org.elasticsearch.client.Client indexClient,
String indexName,
String indexType,
Set<String> allowedIndexTypes) |
static Boolean |
insertRowSet(org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest,
org.elasticsearch.client.Client client,
String indexName,
org.gcube.indexmanagement.common.FullTextIndexType idxType,
Set<String> allowedIndexTypes,
String rowsetXML,
Set<String> securityIdentifiers) |
static void |
insertSimple(String jsonDoc,
org.elasticsearch.client.Client indexClient,
String indexName,
String indexType,
Set<String> allowedIndexTypes) |
static Long |
queryCountElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb) |
static org.elasticsearch.search.SearchHit[] |
queryElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
int from,
List<String> projections,
List<AbstractMap.SimpleEntry<String,String>> sortBys) |
static org.elasticsearch.search.SearchHit[] |
queryElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> projections,
List<AbstractMap.SimpleEntry<String,String>> sortBys) |
static org.elasticsearch.search.SearchHit[] |
queryElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> highlightedFields,
List<String> projections,
int maxFragmentSize,
int maxFragmentCnt,
int from,
List<AbstractMap.SimpleEntry<String,String>> sortBys) |
static org.elasticsearch.action.search.SearchResponse |
queryElasticSearchScroll(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> projections,
List<AbstractMap.SimpleEntry<String,String>> sortBys) |
static org.elasticsearch.action.search.SearchResponse |
queryElasticSearchScroll(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> highlightedFields,
List<String> projections,
int maxFragmentSize,
int maxFragmentCnt,
List<AbstractMap.SimpleEntry<String,String>> sortBys) |
static Map<String,Integer> |
termsFacetElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxTerms,
List<String> projections) |
public static final String SECURITY_FIELD
public static final String STOPWORDS_FILENAME
public static void commit(org.elasticsearch.client.Client client,
String indexName)
public static Map<String,Integer> termsFacetElasticSearch(org.elasticsearch.client.Client client, String indexName, org.elasticsearch.index.query.QueryBuilder qb, int maxTerms, List<String> projections)
public static Set<String> allCollectionsOfIndexElasticSearch(org.elasticsearch.client.Client client, String indexName)
public static Set<String> allLanguagesOfIndexElasticSearch(org.elasticsearch.client.Client client, String indexName, String collection)
public static org.elasticsearch.search.SearchHit[] queryElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> projections,
List<AbstractMap.SimpleEntry<String,String>> sortBys)
public static org.elasticsearch.search.SearchHit[] queryElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
int from,
List<String> projections,
List<AbstractMap.SimpleEntry<String,String>> sortBys)
public static org.elasticsearch.search.SearchHit[] queryElasticSearch(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> highlightedFields,
List<String> projections,
int maxFragmentSize,
int maxFragmentCnt,
int from,
List<AbstractMap.SimpleEntry<String,String>> sortBys)
public static org.elasticsearch.action.search.SearchResponse queryElasticSearchScroll(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> projections,
List<AbstractMap.SimpleEntry<String,String>> sortBys)
public static org.elasticsearch.action.search.SearchResponse queryElasticSearchScroll(org.elasticsearch.client.Client client,
String indexName,
org.elasticsearch.index.query.QueryBuilder qb,
int maxHits,
List<String> highlightedFields,
List<String> projections,
int maxFragmentSize,
int maxFragmentCnt,
List<AbstractMap.SimpleEntry<String,String>> sortBys)
public static Long collectionDocumentsCountElasticSearch(org.elasticsearch.client.Client client, String indexName, String collectionID)
public static Long queryCountElasticSearch(org.elasticsearch.client.Client client, String indexName, org.elasticsearch.index.query.QueryBuilder qb)
public static org.elasticsearch.action.search.SearchResponse getNextSearchResponse(org.elasticsearch.client.Client client,
org.elasticsearch.action.search.SearchResponse scrollResponse)
public static boolean deleteAllIndices(org.elasticsearch.client.Client client)
public static boolean delete(org.elasticsearch.client.Client client,
String indexName)
public static boolean exists(org.elasticsearch.client.Client indexClient,
String indexName)
public static boolean deleteDocuments(org.elasticsearch.client.Client client,
String indexName,
List<String> docIDs)
public static Boolean deleteCollections(org.elasticsearch.client.Client client, String indexName, Collection<String> colls)
public static Boolean deleteCollection(org.elasticsearch.client.Client client, String indexName, String collID)
public static Boolean collectionExists(org.elasticsearch.client.Client client, String indexName, String collID)
public static Set<String> indicesOfCollection(org.elasticsearch.client.Client client, String indexName, String collID)
public static Set<String> getIndicesOfAlias(org.elasticsearch.client.Client client, String alias)
public static List<org.elasticsearch.action.get.MultiGetItemResponse> getMultipleDocumentsOfAlias(org.elasticsearch.client.Client client, String alias, Collection<String> docIDs)
public static List<org.elasticsearch.action.get.MultiGetItemResponse> getMultipleDocuments(org.elasticsearch.client.Client client, Set<String> indices, Collection<String> docIDs)
public static Set<String> getLanguagesOfCollection(org.elasticsearch.client.Client client, String indexName, String collection)
public static Set<String> getAllCollectionsOfIndex(org.elasticsearch.client.Client client, String indexName)
public static void clearIndex(org.elasticsearch.client.Client client,
String indexName,
String indexTypeName)
public static void insertSimple(String jsonDoc, org.elasticsearch.client.Client indexClient, String indexName, String indexType, Set<String> allowedIndexTypes) throws ElasticSearchHelperException
ElasticSearchHelperExceptionpublic static void insertBulk(org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest,
String jsonDoc,
org.elasticsearch.client.Client indexClient,
String indexName,
String indexType,
Set<String> allowedIndexTypes)
throws ElasticSearchHelperException
ElasticSearchHelperExceptionpublic static Boolean insertRowSet(org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest, org.elasticsearch.client.Client client, String indexName, org.gcube.indexmanagement.common.FullTextIndexType idxType, Set<String> allowedIndexTypes, String rowsetXML, Set<String> securityIdentifiers)
public static org.elasticsearch.common.xcontent.XContentBuilder createJSONObject(Map<String,? extends Object> keyValues) throws IOException
IOExceptionpublic static Set<String> getIndexTypesByCollectionIDNoCache(String collID, org.elasticsearch.client.Client client, String indexName)
public static Set<String> getIndexTypesByCollectionIDs(Map<String,Set<String>> indexTypesByCollIDs, Set<String> collIDs, org.elasticsearch.client.Client client, String indexName)
public static Set<String> getIndexTypesByCollectionID(Map<String,Set<String>> indexTypesByCollIDs, String collID, org.elasticsearch.client.Client client, String indexName)
Copyright © 2015. All Rights Reserved.