@Test
  public void regex_forElastic() {
    final PersonGenerator generator = new PersonGenerator();
    insert(generator.next().withFullName("John"));

    check(repository().find(person.fullName.matches(Pattern.compile("John")))).hasSize(1);
    check(repository().find(person.fullName.matches(Pattern.compile("J.*n")))).hasSize(1);
    check(repository().find(person.fullName.not(s ->s.matches(Pattern.compile("J.*n"))))).empty();
    check(repository().find(person.fullName.matches(Pattern.compile("J..n")))).hasSize(1);
    check(repository().find(person.fullName.matches(Pattern.compile("J...")))).hasSize(1);
    check(repository().find(person.fullName.matches(Pattern.compile("...n")))).hasSize(1);
    check(repository().find(person.fullName.matches(Pattern.compile(".*")))).hasSize(1);

    insert(generator.next().withFullName("Mary"));
    check(repository().find(person.fullName.matches(Pattern.compile("J.*n")))).hasSize(1);
    check(repository().find(person.fullName.matches(Pattern.compile("M.*ry")))).hasSize(1);
    check(repository().find(person.fullName.matches(Pattern.compile(".*")))).hasSize(2);
  }
Elastic has special <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html">regex syntax</a>
and not all java patterns are supported. Testing separately here
criteria/elasticsearch/test/org/immutables/criteria/elasticsearch/ElasticPersonTest.java