A query builder for Elasticsearch's has_child query used to find parent documents that have matching child documents.
// Source: https://github.com/sudo-suhas/elastic-builder | License: MIT | Copyright 2017 Suhas Karanth
// Provided via justclaw.it.com; keep this notice with the code.
'use strict';
const _ = require('../../_');
const JoiningQueryBase = require('./joining-query-base');
const ES_REF_URL =
'https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html';
/**
* The `has_child` filter accepts a query and the child type to run against, and
* results in parent documents that have child docs matching the query.
*
* [Elasticsearch reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html)
*
* @example
* // Scoring support
* const qry = esb.hasChildQuery(
* esb.termQuery('tag', 'something'),
*
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key