The following snippet should help:
label = DynamicLabel.label("Label");
Iterable<IndexDefinition> indexes = schema.getIndexes(label);
for(IndexDefinition index : indexes) {
for (String key: index.getPropertyKeys()) {
if (key.equals("id")) {
return true; // index for label and property exists
}
}
}
return false; // no matching schema index
Please note that in Neo4j 2.0/2.1 each index has only one single property. Multi property indexes are not yet supported - however the API is already designed for that.