@Test
  public void boolQuery() throws Exception {
    QueryBuilders.QueryBuilder q1 = QueryBuilders.boolQuery()
            .must(QueryBuilders.termQuery("foo", "bar"));

    assertEquals("{\"bool\":{\"must\":{\"term\":{\"foo\":\"bar\"}}}}",
            toJson(q1));

    QueryBuilders.QueryBuilder q2 = QueryBuilders.boolQuery()
            .must(QueryBuilders.termQuery("f1", "v1")).must(QueryBuilders.termQuery("f2", "v2"));

    assertEquals("{\"bool\":{\"must\":[{\"term\":{\"f1\":\"v1\"}},{\"term\":{\"f2\":\"v2\"}}]}}",
            toJson(q2));

    QueryBuilders.QueryBuilder q3 = QueryBuilders.boolQuery()
            .mustNot(QueryBuilders.termQuery("f1", "v1"));

    assertEquals("{\"bool\":{\"must_not\":{\"term\":{\"f1\":\"v1\"}}}}",
            toJson(q3));

  }
Test for simple scalar terms (boolean, int etc.)
@throws Exception not expected
criteria/elasticsearch/test/org/immutables/criteria/elasticsearch/QueryBuildersTest.java