Skip to content

Commit

Permalink
[Maps] clean up source settings (#52644)
Browse files Browse the repository at this point in the history
* [Maps] clean up source settings

* update es_search_source editor

* geo grid source

* pew pew source

* fix i18n

* doc updates for changing UI

* docs re-wording

* use correct image name

* update snapshot

* review feedback
  • Loading branch information
nreese committed Dec 11, 2019
1 parent e3f3dd1 commit eb8c0e3
Show file tree
Hide file tree
Showing 28 changed files with 594 additions and 632 deletions.
Binary file added docs/maps/images/top_hits.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions docs/maps/indexing-geojson-data-tutorial.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ aggregation.
The remaining default settings are good, but there are a couple of
settings that you might want to change.

. Under *Source settings* > *Grid resolution*, select from the different heat map resolutions.
+
The default "Coarse" looks
good, but feel free to select a different resolution.

. Play around with the *Layer Style* >
*Color range* setting.
+
Expand Down
15 changes: 10 additions & 5 deletions docs/maps/maps-aggregations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,23 @@ The point location is the weighted centroid for all geo-points in the gridded ce

[role="xpack"]
[[maps-top-hits-aggregation]]
=== Most recent entities
=== Top hits per entity

Most recent entities uses {es} {ref}/search-aggregations-bucket-terms-aggregation.html[terms aggregation] to group your documents by entity.
Then, {ref}/search-aggregations-metrics-top-hits-aggregation.html[top hits metric aggregation] accumulates the most recent documents for each entry.
You can display the most relevant documents per entity, for example, the most recent GPS tracks per flight.
To get this data, {es} first groups your data using a {ref}/search-aggregations-bucket-terms-aggregation.html[terms aggregation],
then accumulates the most relevant documents based on sort order for each entry using a {ref}/search-aggregations-metrics-top-hits-aggregation.html[top hits metric aggregation].

Most recent entities is available for <<vector-layer, vector layers>> with *Documents* source.
To enable most recent entities, click "Show most recent documents by entity" and configure the following:
Top hits per entity is available for <<vector-layer, vector layers>> with *Documents* source.
To enable top hits:

. In *Sorting*, select the *Show documents per entity* checkbox.
. Set *Entity* to the field that identifies entities in your documents.
This field will be used in the terms aggregation to group your documents into entity buckets.
. Set *Documents per entity* to configure the maximum number of documents accumulated per entity.

[role="screenshot"]
image::maps/images/top_hits.png[]

[role="xpack"]
[[point-to-point]]
=== Point to point
Expand Down
2 changes: 1 addition & 1 deletion docs/maps/search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The most common cause for empty layers are searches for a field that exists in o

You can prevent the search bar from applying search context to a layer by configuring the following:

* In *Source settings*, clear the *Apply global filter to source* checkbox to turn off the global search context for the layer source.
* In *Filtering*, clear the *Apply global filter to layer data* checkbox to turn off the global search context for the layer source.

* In *Term joins*, clear the *Apply global filter to join* checkbox to turn off the global search context for the <<terms-join, term join>>.

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@

import React from 'react';
import { EuiFormRow, EuiSwitch } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

const label = i18n.translate('xpack.maps.layerPanel.applyGlobalQueryCheckboxLabel', {
defaultMessage: `Apply global filter to source`,
});

export function GlobalFilterCheckbox({ applyGlobalQuery, customLabel, setApplyGlobalQuery }) {
export function GlobalFilterCheckbox({ applyGlobalQuery, label, setApplyGlobalQuery }) {
const onApplyGlobalQueryChange = event => {
setApplyGlobalQuery(event.target.checked);
};
Expand All @@ -22,7 +17,7 @@ export function GlobalFilterCheckbox({ applyGlobalQuery, customLabel, setApplyGl
display="columnCompressedSwitch"
>
<EuiSwitch
label={customLabel ? customLabel : label}
label={label}
checked={applyGlobalQuery}
onChange={onApplyGlobalQueryChange}
data-test-subj="mapLayerPanelApplyGlobalQueryCheckbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import {
EuiDroppable,
EuiText,
EuiTextAlign,
EuiTitle,
EuiSpacer,
} from '@elastic/eui';
import { AddTooltipFieldPopover } from './add_tooltip_field_popover';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

// TODO import reorder from EUI once its exposed as service
Expand Down Expand Up @@ -213,13 +211,6 @@ export class TooltipSelector extends Component {
render() {
return (
<div>
<EuiTitle size="xxs">
<h6>
<FormattedMessage id="xpack.maps.tooltipSelectorLabel" defaultMessage="Fields to display in tooltip" />
</h6>
</EuiTitle>
<EuiSpacer size="xs" />

{this._renderProperties()}

<EuiSpacer size="s" />
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ import {
EuiTextColor,
EuiTextAlign,
EuiButtonEmpty,
EuiFormRow,
EuiSwitch,
} from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { indexPatternService } from '../../../kibana_services';
import { GlobalFilterCheckbox } from '../../../components/global_filter_checkbox';

import { start as data } from '../../../../../../../../src/legacy/core_plugins/data/public/legacy';
const { SearchBar } = data.ui;
Expand Down Expand Up @@ -79,6 +82,14 @@ export class FilterEditor extends Component {
this._close();
};

_onFilterByMapBoundsChange = event => {
this.props.updateSourceProp(this.props.layer.getId(), 'filterByMapBounds', event.target.checked);
};

_onApplyGlobalQueryChange = applyGlobalQuery => {
this.props.updateSourceProp(this.props.layer.getId(), 'applyGlobalQuery', applyGlobalQuery);
};

_renderQueryPopover() {
const layerQuery = this.props.layer.getQuery();
const { uiSettings } = npStart.core;
Expand Down Expand Up @@ -169,13 +180,29 @@ export class FilterEditor extends Component {
}

render() {
let filterByBoundsSwitch;
if (this.props.layer.getSource().isFilterByMapBoundsConfigurable()) {
filterByBoundsSwitch = (
<EuiFormRow display="rowCompressed">
<EuiSwitch
label={i18n.translate('xpack.maps.filterEditor.extentFilterLabel', {
defaultMessage: 'Dynamically filter for data in the visible map area',
})}
checked={this.props.layer.getSource().isFilterByMapBounds()}
onChange={this._onFilterByMapBoundsChange}
compressed
/>
</EuiFormRow>
);
}

return (
<Fragment>
<EuiTitle size="xs">
<h5>
<FormattedMessage
id="xpack.maps.layerPanel.filterEditor.title"
defaultMessage="Filter"
defaultMessage="Filtering"
/>
</h5>
</EuiTitle>
Expand All @@ -185,6 +212,18 @@ export class FilterEditor extends Component {
{this._renderQuery()}

<EuiTextAlign textAlign="center">{this._renderQueryPopover()}</EuiTextAlign>

<EuiSpacer size="m" />

{filterByBoundsSwitch}

<GlobalFilterCheckbox
label={i18n.translate('xpack.maps.filterEditor.applyGlobalQueryCheckboxLabel', {
defaultMessage: `Apply global filter to layer data`,
})}
applyGlobalQuery={this.props.layer.getSource().getApplyGlobalQuery()}
setApplyGlobalQuery={this._onApplyGlobalQueryChange}
/>
</Fragment>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { connect } from 'react-redux';
import { FilterEditor } from './filter_editor';
import { getSelectedLayer } from '../../../selectors/map_selectors';
import { setLayerQuery } from '../../../actions/map_actions';
import { setLayerQuery, updateSourceProp } from '../../../actions/map_actions';

function mapStateToProps(state = {}) {
return {
Expand All @@ -19,7 +19,8 @@ function mapDispatchToProps(dispatch) {
return {
setLayerQuery: (layerId, query) => {
dispatch(setLayerQuery(layerId, query));
}
},
updateSourceProp: (id, propName, value) => dispatch(updateSourceProp(id, propName, value)),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { connect } from 'react-redux';
import { LayerPanel } from './view';
import { getSelectedLayer } from '../../selectors/map_selectors';
import {
fitToLayerExtent
fitToLayerExtent,
updateSourceProp,
} from '../../actions/map_actions';

function mapStateToProps(state = {}) {
Expand All @@ -21,7 +22,8 @@ function mapDispatchToProps(dispatch) {
return {
fitToBounds: (layerId) => {
dispatch(fitToLayerExtent(layerId));
}
},
updateSourceProp: (id, propName, value) => dispatch(updateSourceProp(id, propName, value)),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class Join extends Component {
<GlobalFilterCheckbox
applyGlobalQuery={right.applyGlobalQuery}
setApplyGlobalQuery={this._onApplyGlobalQueryChange}
customLabel={i18n.translate('xpack.maps.layerPanel.join.applyGlobalQueryCheckboxLabel', {
label={i18n.translate('xpack.maps.layerPanel.join.applyGlobalQueryCheckboxLabel', {
defaultMessage: `Apply global filter to join`,
})}
/>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit eb8c0e3

Please sign in to comment.