elastic search GetIndexRequest code example
Example 1: getindexrequest elasticsearch
public List<String> getIndexListWithPrefix(Object object) {
LOG.info("Retrieving index list with prefix: {}", object.toString());
String[] indices = client.admin().indices().getIndex(new GetIndexRequest()).actionGet().getIndices();
ArrayList<String> indexList = new ArrayList<>();
int length = indices.length;
for (int i = 0; i < length; i++) {
String indexName = indices[i];
if (indexName.startsWith(object.toString())) {
indexList.add(indexName);
}
}
return indexList;
}
Example 2: getindexrequest elasticsearch
GetIndexRequest request = new GetIndexRequest("index");