static Predicate<Path> idPredicate(KeyExtractor.KeyMetadata metadata) {
    Objects.requireNonNull(metadata, "metadata");
    Predicate<Path> alwaysFalse = p -> false;
    if (!(metadata.isKeyDefined() && metadata.isExpression())) {
      return alwaysFalse;
    }

    if (metadata.keys().size() != 1) {
      return alwaysFalse;
    }

    Expression expression = Iterables.getOnlyElement(metadata.keys());
    return Visitors.maybePath(expression)
            .map(p -> ((Predicate<Path>) p::equals))
            .orElse(alwaysFalse);
  }
Predicate which checks if a path represents entity key (id). Used to generate {@code ids}
type of queries.
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/Elasticsearch.java