Bodybuilder Nested query. If its bodybuilder keyword like path or min_doc_count, we can include it inside the main within {}. It will be added under it
bodybuilder()
.query('nested', { path: 'mainAuthor' }, (q) => {
return q
.query('query_string', 'fields' , '[mainAuthor.nameCorporatePrimary]')
.query('query','Art Institute of Chicago')
})
.rawOption('default_operator','AND')
.build()
var body = new $window.bodybuilder();
var resultQuery = body
.orFilter('terms', 'id', ids)
.aggregation('term', 'identifier', 'identifier', { min_doc_count: 2 })
.build();