"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDeviceOSApp = getDeviceOSApp; var _server = require("@kbn/observability-plugin/server"); var _common = require("@kbn/observability-plugin/common"); var _apm = require("../../../common/es_fields/apm"); var _environment_query = require("../../../common/utils/environment_query"); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ async function getDeviceOSApp({ kuery, apmEventClient, serviceName, transactionType, environment, start, end, size }) { return await apmEventClient.search('get_mobile_device_os_app', { apm: { events: [_common.ProcessorEvent.transaction] }, body: { track_total_hits: false, size: 0, query: { bool: { filter: [...(0, _server.termQuery)(_apm.SERVICE_NAME, serviceName), ...(0, _server.termQuery)(_apm.TRANSACTION_TYPE, transactionType), ...(0, _server.rangeQuery)(start, end), ...(0, _environment_query.environmentQuery)(environment), ...(0, _server.kqlQuery)(kuery)] } }, aggs: { devices: { terms: { field: _apm.DEVICE_MODEL_IDENTIFIER, size } }, osVersions: { terms: { field: _apm.HOST_OS_VERSION, size } }, appVersions: { terms: { field: _apm.SERVICE_VERSION, size } } } } }); }