fix remaining errors

This commit is contained in:
Mikhail Shustov 2021-05-18 15:15:55 +02:00
parent 4f6a79d407
commit 39c5e1cb5c
14 changed files with 17 additions and 17 deletions

View file

@ -218,7 +218,7 @@ export async function getTile({
// Todo: pass in epochMillies-fields
const featureCollection = hitsToGeoJson(
// @ts-expect-error hitsToGeoJson should be refactored to accept estypes.Hit
// @ts-expect-error hitsToGeoJson should be refactored to accept estypes.SearchTypesHit
documentsResponse.rawResponse.hits.hits,
(hit: Record<string, unknown>) => {
return flattenHit(geometryFieldName, hit);

View file

@ -13,7 +13,7 @@ export type Datafeed = estypes.Datafeed;
export type ChunkingConfig = estypes.ChunkingConfig;
export type Aggregation = Record<string, estypes.AggregationContainer>;
export type Aggregation = Record<string, estypes.AggregationsAggregationContainer>;
// export type IndicesOptions = estypes.IndicesOptions;
export interface IndicesOptions {

View file

@ -76,7 +76,7 @@ export interface DataFrameAnalyticsConfig {
};
source: {
index: IndexName | IndexName[];
query?: estypes.QueryContainer;
query?: estypes.QueryDslQueryContainer;
runtime_mappings?: RuntimeMappings;
};
analysis: AnalysisConfig;

View file

@ -78,7 +78,7 @@ export function isMappableJob(job: CombinedJob, detectorIndex: number): boolean
* if composite is defined.
* @param buckets
*/
export function hasValidComposite(buckets: estypes.AggregationContainer) {
export function hasValidComposite(buckets: estypes.AggregationsAggregationContainer) {
if (
isPopulatedObject(buckets, ['composite']) &&
isPopulatedObject(buckets.composite, ['sources']) &&
@ -157,7 +157,7 @@ export function isSourceDataChartableForDetector(job: CombinedJob, detectorIndex
}
// if fieldName is an aggregated field under nested terms using bucket_script
const aggregations =
getAggregations<estypes.AggregationContainer>(aggs[aggBucketsName]) ?? {};
getAggregations<estypes.AggregationsAggregationContainer>(aggs[aggBucketsName]) ?? {};
const foundField = findAggField(aggregations, dtr.field_name, false);
if (foundField?.bucket_script !== undefined) {
return false;

View file

@ -44,7 +44,7 @@ export function buildBaseFilterCriteria(
export function buildSamplerAggregation(
aggs: any,
samplerShardSize: number
): Record<string, estypes.AggregationContainer> {
): Record<string, estypes.AggregationsAggregationContainer> {
if (samplerShardSize < 1) {
return aggs;
}

View file

@ -37,7 +37,7 @@ export type FactoryQueryTypes = OsqueryQueries;
export interface RequestBasicOptions extends IEsSearchRequest {
filterQuery: ESQuery | string | undefined;
aggregations?: Record<string, estypes.AggregationContainer>;
aggregations?: Record<string, estypes.AggregationsAggregationContainer>;
docValueFields?: DocValueFields[];
factoryQueryType?: FactoryQueryTypes;
}

View file

@ -85,7 +85,6 @@ export class ReportingStore {
try {
await client.indices.create({
index: indexName,
// @ts-expect-error @elastic/elasticsearch types don't support nested mappings
body,
});

View file

@ -81,7 +81,6 @@ const getSavedObjectsList = async ({
ignore_unavailable: true,
index: kibanaIndex,
size: ES_MAX_RESULT_WINDOW_DEFAULT_VALUE,
// @ts-expect-error@elastic/elasticsearch _source does not exist in type SearchRequest
_source: filterPath,
});
return esResponse;

View file

@ -17,7 +17,10 @@ export function defineGetBuiltinPrivilegesRoutes({ router }: RouteDefinitionPara
// Exclude the `none` privilege, as it doesn't make sense as an option within the Kibana UI
privileges.cluster = privileges.cluster.filter((privilege) => privilege !== 'none');
privileges.index = privileges.index.filter((privilege) => privilege !== 'none');
const indexPriviledges = Array.isArray(privileges.index)
? privileges.index
: [privileges.index];
privileges.index = indexPriviledges.filter((privilege) => privilege !== 'none');
return response.ok({ body: privileges });
}

View file

@ -339,7 +339,6 @@ export class SessionIndex {
try {
await this.options.elasticsearchClient.indices.putTemplate({
name: sessionIndexTemplateName,
// @ts-expect-error @elastic-elasticsearch types don't support nested properties
body: getSessionIndexTemplate(this.indexName),
});
this.options.logger.debug('Successfully created session index template.');

View file

@ -7,7 +7,7 @@
import type { estypes } from '@elastic/elasticsearch';
import { ElasticsearchClient } from 'src/core/server';
export type ESLicense = estypes.LicenseInformation;
export type ESLicense = estypes.LicenseGetLicenseLicenseInformation;
let cachedLicense: ESLicense | undefined;

View file

@ -91,7 +91,7 @@ function mockEsClient() {
cluster_uuid: 'test',
cluster_name: 'test',
version: { number: '8.0.0' } as estypes.ElasticsearchVersionInfo,
} as estypes.RootNodeInfoResponse,
} as estypes.InfoResponse,
}
);

View file

@ -252,7 +252,7 @@ export function registerTransformsRoutes(routeDependencies: RouteDependencies) {
const {
body,
} = await ctx.core.elasticsearch.client.asCurrentUser.transform.updateTransform({
// @ts-expect-error query doesn't satisfy QueryContainer from @elastic/elasticsearch
// @ts-expect-error query doesn't satisfy QueryDslQueryContainer from @elastic/elasticsearch
body: req.body,
transform_id: transformId,
});

View file

@ -47,7 +47,7 @@ export const getSignalsWithES = async ({
es: KibanaClient;
indices: string | string[];
ids: string | string[];
}): Promise<Map<string, Map<string, estypes.Hit<SignalHit>>>> => {
}): Promise<Map<string, Map<string, estypes.SearchTypesHit<SignalHit>>>> => {
const signals: ApiResponse<estypes.SearchResponse<SignalHit>> = await es.search({
index: indices,
body: {
@ -69,13 +69,13 @@ export const getSignalsWithES = async ({
return signals.body.hits.hits.reduce((acc, hit) => {
let indexMap = acc.get(hit._index);
if (indexMap === undefined) {
indexMap = new Map<string, estypes.Hit<SignalHit>>([[hit._id, hit]]);
indexMap = new Map<string, estypes.SearchTypesHit<SignalHit>>([[hit._id, hit]]);
} else {
indexMap.set(hit._id, hit);
}
acc.set(hit._index, indexMap);
return acc;
}, new Map<string, Map<string, estypes.Hit<SignalHit>>>());
}, new Map<string, Map<string, estypes.SearchTypesHit<SignalHit>>>());
};
interface SetStatusCasesParams {