public boolean indexExists(String index) { return exists(index); }
public boolean documentExists(String index, String type, String id) { return exists(index + "/" + type + "/" + id); }
public boolean typeExists(String index, String type) { String indexType; if (internalVersion.onOrAfter(EsMajorVersion.V_5_X)) { indexType = index + "/_mapping/" + type; } else { indexType = index + "/" + type; } return exists(indexType); }
public boolean documentExists(String index, String type, String id) { return exists(index + "/" + type + "/" + id); }
public boolean indexExists(String index) { return exists(index); }
public boolean documentExists(String index, String type, String id) { return exists(index + "/" + type + "/" + id); }
public boolean indexExists(String index) { return exists(index); }
public boolean documentExists(String index, String type, String id) { return exists(index + "/" + type + "/" + id); }
public boolean indexExists(String index) { return exists(index); }
public boolean typeExists(String index, String type) { String indexType; if (internalVersion.onOrAfter(EsMajorVersion.V_5_X)) { indexType = index + "/_mapping/" + type; } else { indexType = index + "/" + type; } return exists(indexType); }
public boolean typeExists(String index, String type) { String indexType; if (internalVersion.onOrAfter(EsMajorVersion.V_5_X)) { indexType = index + "/_mapping/" + type; } else { indexType = index + "/" + type; } return exists(indexType); }
public boolean typeExists(String index, String type) { String indexType; if (internalVersion.onOrAfter(EsMajorVersion.V_5_X)) { indexType = index + "/_mapping/" + type; } else { indexType = index + "/" + type; } return exists(indexType); }
public boolean isEmpty(boolean read) { Resource res = (read ? resourceR : resourceW); boolean exists = client.exists(res.indexAndType()); return (exists ? count(read) <= 0 : true); }
public boolean indexExists(boolean read) { Resource res = (read ? resourceR : resourceW); // cheap hit boolean exists = client.exists(res.indexAndType()); // could be a _all or a pattern which is valid for read // try again by asking the mapping - could be expensive if (!exists && read) { try { // make sure the mapping is null since the index might exist but the type might be missing exists = !client.getMapping(res.mapping()).isEmpty(); } catch (EsHadoopInvalidRequest ex) { exists = false; } } return exists; }
public boolean touch(String indexOrType) { if (!exists(indexOrType)) { Response response = execute(PUT, indexOrType, false); if (response.hasFailed()) { String msg = null; // try to parse the answer try { msg = parseContent(response.body(), "error"); } catch (Exception ex) { // can't parse message, move on } if (StringUtils.hasText(msg) && !msg.contains("IndexAlreadyExistsException")) { throw new EsHadoopIllegalStateException(msg); } } return response.hasSucceeded(); } return false; }