mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[maps][ESQL] fix esql layers do not support spatial filters drawn on map (#176753)
Closes https://github.com/elastic/kibana/issues/176752
### test instructions
1. install sample web logs
2. create new map
3. add "ES|QL" layer
4. verify drawing tools are enable on map and drawing a filter narrows
ES|QL layer.
<img width="600" alt="Screenshot 2024-02-12 at 12 38 03 PM"
src="fffb77de
-f2fd-43f0-9a87-a5f44ff68ee2">
This commit is contained in:
parent
8af71e4889
commit
7f4208ac9b
4 changed files with 17 additions and 4 deletions
|
@ -51,7 +51,9 @@ export type ESQLSourceDescriptor = AbstractSourceDescriptor & {
|
|||
*/
|
||||
dateField?: string;
|
||||
/*
|
||||
* Geo field used to narrow ES|QL requests by visible map area
|
||||
* Geo field used to narrow ES|QL requests by
|
||||
* 1. by visible map area
|
||||
* 2. spatial filters drawn on map
|
||||
*/
|
||||
geoField?: string;
|
||||
narrowByGlobalSearch: boolean;
|
||||
|
|
|
@ -577,7 +577,10 @@ export class AbstractLayer implements ILayer {
|
|||
|
||||
getGeoFieldNames(): string[] {
|
||||
const source = this.getSource();
|
||||
return hasESSourceMethod(source, 'getGeoFieldName') ? [source.getGeoFieldName()] : [];
|
||||
const geoFieldName = hasESSourceMethod(source, 'getGeoFieldName')
|
||||
? source.getGeoFieldName()
|
||||
: undefined;
|
||||
return geoFieldName ? [geoFieldName] : [];
|
||||
}
|
||||
|
||||
async getStyleMetaDescriptorFromLocalFeatures(): Promise<StyleMetaDescriptor | null> {
|
||||
|
|
|
@ -49,7 +49,7 @@ export interface IESSource extends IVectorSource {
|
|||
|
||||
getIndexPatternId(): string;
|
||||
|
||||
getGeoFieldName(): string;
|
||||
getGeoFieldName(): string | undefined;
|
||||
|
||||
loadStylePropsMeta({
|
||||
layerName,
|
||||
|
|
|
@ -28,6 +28,7 @@ import { isValidStringConfig } from '../../util/valid_string_config';
|
|||
import type { SourceEditorArgs } from '../source';
|
||||
import { AbstractVectorSource, getLayerFeaturesRequestName } from '../vector_source';
|
||||
import type { IVectorSource, GeoJsonWithMeta, SourceStatus } from '../vector_source';
|
||||
import type { IESSource } from '../es_source';
|
||||
import type { IField } from '../../fields/field';
|
||||
import { InlineField } from '../../fields/inline_field';
|
||||
import { getData, getUiSettings } from '../../../kibana_services';
|
||||
|
@ -44,7 +45,10 @@ export const sourceTitle = i18n.translate('xpack.maps.source.esqlSearchTitle', {
|
|||
defaultMessage: 'ES|QL',
|
||||
});
|
||||
|
||||
export class ESQLSource extends AbstractVectorSource implements IVectorSource {
|
||||
export class ESQLSource
|
||||
extends AbstractVectorSource
|
||||
implements IVectorSource, Pick<IESSource, 'getIndexPatternId' | 'getGeoFieldName'>
|
||||
{
|
||||
readonly _descriptor: ESQLSourceDescriptor;
|
||||
|
||||
static createDescriptor(descriptor: Partial<ESQLSourceDescriptor>): ESQLSourceDescriptor {
|
||||
|
@ -325,4 +329,8 @@ export class ESQLSource extends AbstractVectorSource implements IVectorSource {
|
|||
getIndexPatternId() {
|
||||
return this._descriptor.dataViewId;
|
||||
}
|
||||
|
||||
getGeoFieldName() {
|
||||
return this._descriptor.geoField;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue