Skip to content

Commit

Permalink
remove elasticsearch import from maps
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jul 29, 2021
1 parent c6c23bc commit 7eaab28
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { ReactElement } from 'react';
import { i18n } from '@kbn/i18n';
import rison from 'rison-node';
import { Feature } from 'geojson';
import { SearchResponse } from 'elasticsearch';
import type { estypes } from '@elastic/elasticsearch';
import {
convertCompositeRespToGeoJson,
convertRegularRespToGeoJson,
Expand Down Expand Up @@ -274,7 +274,7 @@ export class ESGeoGridSource extends AbstractESAggSource implements ITiledSingle
const requestId: string = afterKey
? `${this.getId()} afterKey ${afterKey.geoSplit}`
: this.getId();
const esResponse: SearchResponse<unknown> = await this._runEsQuery({
const esResponse: estypes.SearchResponse<unknown> = await this._runEsQuery({
requestId,
requestName: `${layerName} (${requestCount})`,
searchSource,
Expand All @@ -291,8 +291,10 @@ export class ESGeoGridSource extends AbstractESAggSource implements ITiledSingle

features.push(...convertCompositeRespToGeoJson(esResponse, this._descriptor.requestType));

afterKey = esResponse.aggregations.compositeSplit.after_key;
if (esResponse.aggregations.compositeSplit.buckets.length < gridsPerRequest) {
const aggr = esResponse.aggregations
?.compositeSplit as estypes.AggregationsCompositeBucketAggregate;
afterKey = aggr.after_key;
if (aggr.buckets.length < gridsPerRequest) {
// Finished because request did not get full resultset back
break;
}
Expand Down

0 comments on commit 7eaab28

Please sign in to comment.