[Maps] remove Kibana 8.1 deprecated API usage (#128912)

* [Maps] remove remaining 8.1.0 deprecations

* fetch

* review feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2022-03-30 19:09:40 -06:00 committed by GitHub
parent e7eea48a6c
commit d0e4eefb47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 23 deletions

View file

@ -201,11 +201,13 @@ export class ESPewPewSource extends AbstractESAggSource {
try {
const abortController = new AbortController();
registerCancelCallback(() => abortController.abort());
const esResp = await searchSource.fetch({
abortSignal: abortController.signal,
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_pew_pew_source:bounds'),
});
const { rawResponse: esResp } = await searchSource
.fetch$({
abortSignal: abortController.signal,
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_pew_pew_source:bounds'),
})
.toPromise();
if (esResp.aggregations.destFitToBounds.bounds) {
corners.push([
esResp.aggregations.destFitToBounds.bounds.top_left.lon,

View file

@ -597,10 +597,12 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
searchSource.setField('query', query);
searchSource.setField('fieldsFromSource', this._getTooltipPropertyNames());
const resp = await searchSource.fetch({
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_search_source:load_tooltip_properties'),
});
const { rawResponse: resp } = await searchSource
.fetch$({
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_search_source:load_tooltip_properties'),
})
.toPromise();
const hit = _.get(resp, 'hits.hits[0]');
if (!hit) {
@ -899,12 +901,14 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
const maxResultWindow = await this.getMaxResultWindow();
const searchSource = await this.makeSearchSource(searchFilters, 0);
searchSource.setField('trackTotalHits', maxResultWindow + 1);
const resp = await searchSource.fetch({
abortSignal: abortController.signal,
sessionId: searchFilters.searchSessionId,
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_search_source:all_doc_counts'),
});
const { rawResponse: resp } = await searchSource
.fetch$({
abortSignal: abortController.signal,
sessionId: searchFilters.searchSessionId,
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_search_source:all_doc_counts'),
})
.toPromise();
return !isTotalHitsGreaterThan(resp.hits.total as unknown as TotalHits, maxResultWindow);
}
}

View file

@ -279,11 +279,13 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
try {
const abortController = new AbortController();
registerCancelCallback(() => abortController.abort());
const esResp = await searchSource.fetch({
abortSignal: abortController.signal,
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_source:bounds'),
});
const { rawResponse: esResp } = await searchSource
.fetch$({
abortSignal: abortController.signal,
legacyHitsTotal: false,
executionContext: makePublicExecutionContext('es_source:bounds'),
})
.toPromise();
if (!esResp.aggregations) {
return null;

View file

@ -7,7 +7,7 @@
import { canSkipSourceUpdate, updateDueToExtent } from './can_skip_fetch';
import { DataRequest } from './data_request';
import { Filter } from 'src/plugins/data/common';
import { Filter } from '@kbn/es-query';
import { ISource } from '../sources/source';
describe('updateDueToExtent', () => {

View file

@ -6,7 +6,7 @@
*/
import { LAYER_TYPE, SOURCE_TYPES, SCALING_TYPES } from '../common/constants';
import { esFilters } from '../../../../src/plugins/data/public';
import { FilterStateStore } from '@kbn/es-query';
import { MapsAppLocatorDefinition } from './locators';
import { SerializableRecord } from '@kbn/utility-types';
import { LayerDescriptor } from '../common/descriptor_types';
@ -100,7 +100,7 @@ describe('visualize url generator', () => {
},
query: { query: 'q1' },
$state: {
store: esFilters.FilterStateStore.GLOBAL_STATE,
store: FilterStateStore.GLOBAL_STATE,
},
},
],