@SuppressWarnings("unchecked")
public <S extends PropertyContainer> IndexHits<S> queryIndex(Class<S> entityType, String indexName, String key, Object value) {
String indexPath = queryPath(entityType, indexName, key, value);
RequestResult response = restRequest.get(indexPath);
if (response.statusIs(Response.Status.OK)) {
return new RestIndexHitsConverter(this, entityType).convertFromRepresentation(response);
} else {
return new SimpleIndexHits<S>(Collections.emptyList(), 0, entityType, this);
}
}