@Test public void shouldExportBooleanFieldQuery() throws Exception { BooleanFieldQuery fts = SearchQuery.booleanField(true); SearchQuery query = new SearchQuery("foo", fts); JsonObject expected = JsonObject.create().put("query", JsonObject.create().put("bool", true)); assertEquals(expected, query.export()); }
@Test public void shouldExportBooleanFieldQueryWithAllOptions() { BooleanFieldQuery fts = SearchQuery.booleanField(true).boost(1.5).field("field"); SearchQuery query = new SearchQuery("foo", fts).limit(10); JsonObject expected = JsonObject.create() .put( "query", JsonObject.create().put("bool", true).put("boost", 1.5).put("field", "field")) .put("size", 10); assertEquals(expected, query.export()); }