// Condition builder for property exists exists(key) { // Either the property should exist // or it should be equal to `dancing_monkey` // Implicit `minimum_should_match = 1` return bob .boolQuery() .should(bob.termQuery(key, 'dancing_monkey')) .should(bob.existsQuery(key)); }
describe('parse', () => { it('reads custom config if applicable', () => { const qry = parse('["foo"] == "bar"'); expect(qry).toEqual( bob.boolQuery().must(bob.termQuery('$foo.keyword', 'bar')) ); }); });