UNPKG

dsl-builder

Version:

OpenSearch Query Builder - Extract from OpenSearch Dashboards

28 lines (27 loc) 782 B
/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. * * Any modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ import * as ast from '../ast'; export function buildNodeParams(children) { return { arguments: children, }; } export function toOpenSearchQuery(node, indexPattern, config = {}, context = {}) { const children = node.arguments || []; return { bool: { should: children.map((child) => { return ast.toOpenSearchQuery(child, indexPattern, config, context); }), minimum_should_match: 1, }, }; }