Skip to content

Commit

Permalink
Merge branch 'master' into unique_count
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Oct 24, 2019
2 parents 4387e6d + b75f5e2 commit 7d5347a
Show file tree
Hide file tree
Showing 398 changed files with 10,411 additions and 8,244 deletions.
6 changes: 3 additions & 3 deletions docs/maps/geojson-upload.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ for example, in visualizations and Canvas workpads.
[float]
=== Why GeoJSON?
GeoJSON is an open-standard file format for storing geospatial vector data.
Although many vector data formats are available in the GIS community,
Although many vector data formats are available in the GIS community,
GeoJSON is the most commonly used and flexible option.
[float]

Expand All @@ -18,14 +18,14 @@ Follow the instructions below to upload a GeoJSON data file, or try the
<<indexing-geojson-data-tutorial, end-to-end integrated example>>.

. Open *Elastic Maps*, and then click *Add layer*.
. Click *Upload GeoJSON vector file*.
. Click *Uploaded GeoJSON*.
+
[role="screenshot"]
image::maps/images/fu_gs_select_source_file_upload.png[]

. Use the file chooser to select a valid GeoJSON file. The file will load
a preview of the data on the map.
. Use the default *Index type* of {ref}/geo-point.html[geo_point] for point data,
. Use the default *Index type* of {ref}/geo-point.html[geo_point] for point data,
or override it and select {ref}/geo-shape.html[geo_shape].
All other shapes will default to a type of `geo_shape`.
. Leave the default *Index name* and *Index pattern* names (the name of the uploaded
Expand Down
38 changes: 19 additions & 19 deletions docs/maps/indexing-geojson-data-tutorial.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[[indexing-geojson-data-tutorial]]
== Indexing GeoJSON data tutorial

In this tutorial, you'll build a customized map that shows the flight path between
In this tutorial, you'll build a customized map that shows the flight path between
two airports, and the lightning hot spots on that route. You'll learn to:

* Import GeoJSON files into Kibana
Expand All @@ -15,15 +15,15 @@ two airports, and the lightning hot spots on that route. You'll learn to:
This tutorial requires you to download the following GeoJSON sample data files.
These files are good examples of the types
of vector data that you can upload to Kibana and index in
Elasticsearch for display in *Elastic Maps*.
Elasticsearch for display in *Elastic Maps*.

* https://raw.githubusercontent.com/elastic/examples/master/Maps/Getting%20Started%20Examples/geojson_upload_and_styling/logan_international_airport.geojson[Logan International Airport]
* https://raw.githubusercontent.com/elastic/examples/master/Maps/Getting%20Started%20Examples/geojson_upload_and_styling/bangor_international_airport.geojson[Bangor International Airport]
* https://raw.githubusercontent.com/elastic/examples/master/Maps/Getting%20Started%20Examples/geojson_upload_and_styling/lightning_detected.geojson[Lightning detected]
* https://raw.githubusercontent.com/elastic/examples/master/Maps/Getting%20Started%20Examples/geojson_upload_and_styling/original_flight_path.geojson[Original flight path]
* https://raw.githubusercontent.com/elastic/examples/master/Maps/Getting%20Started%20Examples/geojson_upload_and_styling/modified_flight_path.geojson[Modified flight path]

The data represents two real airports, two fictitious flight routes, and
The data represents two real airports, two fictitious flight routes, and
fictitious lightning reports. You don't need to use all of
these files. Feel free to work with as many files as you'd like, or use valid GeoJSON
files of your own.
Expand All @@ -47,20 +47,20 @@ image::maps/images/fu_gs_new_england_map.png[]
For each GeoJSON file you downloaded, complete the following steps:

. Below the map legend, click *Add layer*.
. From the list of layer types, click *Upload GeoJSON vector file*.
. From the list of layer types, click *Uploaded GeoJSON*.
. Using the File Picker, upload the GeoJSON file.
+
Depending on the geometry type of your features, this will
Depending on the geometry type of your features, this will
auto-populate *Index type* with either {ref}/geo-point.html[geo_point] or
{ref}/geo-shape.html[geo_shape] and *Index name* with
{ref}/geo-shape.html[geo_shape] and *Index name* with
`<file name>`.

. Click *Import file* in the lower right.
+
You'll see activity as the GeoJSON Upload utility creates a new index
and index pattern for the data set. When the process is complete, you should
receive messages that the creation of the new index and index pattern
were successful.
were successful.

. Click *Add layer* in the bottom right.

Expand All @@ -69,7 +69,7 @@ were successful.
. Once you've added all of the sample files,
<<maps-save, save your map>>.
+
At this point, you could consider the map complete,
At this point, you could consider the map complete,
but there are a few additions and tweaks that you can make to tell a
better story with your data.
+
Expand All @@ -80,34 +80,34 @@ image::maps/images/fu_gs_flight_paths.png[]
=== Add a heatmap aggregation layer

Looking at the `Lightning detected` layer, it's clear where lightning has
struck. What's less clear, is if there have been more lightning
strikes in some areas than others, in other words, where the lightning
struck. What's less clear, is if there have been more lightning
strikes in some areas than others, in other words, where the lightning
hot spots are. An advantage of having indexed
{ref}/geo-point.html[geo_point] data for the
lightning strikes is that you can perform aggregations on the data.
{ref}/geo-point.html[geo_point] data for the
lightning strikes is that you can perform aggregations on the data.

. Below the map legend, click *Add layer*.
. From the list of layer types, click *Grid aggregation*.
+
Because you indexed `lightning_detected.geojson` using the index name and
Because you indexed `lightning_detected.geojson` using the index name and
pattern `lightning_detected`, that data is available as a {ref}/geo-point.html[geo_point]
aggregation.
aggregation.

. Select `lightning_detected`.
. Click *Show as* and select `heat map`.
. Click *Add layer* to add the heat map layer
"Lightning intensity".
+
The remaining default settings are good, but there are a couple of
settings that you might want to change.
settings that you might want to change.

. Under *Source settings* > *Grid resolution*, select from the different heat map resolutions.
. 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.
*Color range* setting.
+
Again the default looks good, but feel free to choose a
different color range.
Expand All @@ -125,14 +125,14 @@ image::maps/images/fu_gs_lightning_intensity.png[]
=== Organize the layers

Consider ways you might improve the appearance of the final map.
Small changes in how and when layers are shown can help tell a
Small changes in how and when layers are shown can help tell a
better story with your data. Here are a few final tweaks
you might make:

* Update layer names
* Adjust styles for each layer
* Adjust the layer order
* Decide which layers to show at different zoom levels
* Decide which layers to show at different zoom levels

When you've finished, again be sure to <<maps-save, save your work >>.

Expand Down
2 changes: 1 addition & 1 deletion docs/maps/maps-getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ and lighter shades symbolize countries with less traffic.
==== Add a vector layer from the Elastic Maps Service source

. In the map legend, click *Add layer*.
. Click the *Vector shapes* data source.
. Click the *EMS Boundaries* data source.
. From the *Layer* dropdown menu, select *World Countries*.
. Click the *Add layer* button.
. Set *Layer name* to `Total Requests by Country`.
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"**/typescript": "3.5.3",
"**/graphql-toolkit/lodash": "^4.17.13",
"**/isomorphic-git/**/base64-js": "^1.2.1",
"**/babel-plugin-inline-react-svg/svgo/js-yaml": "^3.13.1"
"**/babel-plugin-inline-react-svg/svgo/js-yaml": "^3.13.1",
"**/image-diff/gm/debug": "^2.6.9"
},
"workspaces": {
"packages": [
Expand All @@ -106,7 +107,7 @@
"dependencies": {
"@babel/core": "^7.5.5",
"@babel/register": "^7.5.5",
"@elastic/charts": "^13.5.4",
"@elastic/charts": "^13.5.7",
"@elastic/datemath": "5.0.2",
"@elastic/ems-client": "1.0.5",
"@elastic/eui": "14.5.0",
Expand Down Expand Up @@ -159,7 +160,7 @@
"elasticsearch": "^16.4.0",
"elasticsearch-browser": "^16.4.0",
"encode-uri-query": "1.0.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"expiry-js": "0.1.7",
"file-loader": "4.2.0",
"font-awesome": "4.7.0",
Expand Down Expand Up @@ -275,7 +276,7 @@
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^4.5.0",
"@elastic/makelogs": "^5.0.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/es": "1.0.0",
"@kbn/eslint-import-resolver-kibana": "2.0.0",
Expand All @@ -302,7 +303,6 @@
"@types/elasticsearch": "^5.0.33",
"@types/enzyme": "^3.9.0",
"@types/eslint": "^6.1.2",
"@types/execa": "^0.9.0",
"@types/fetch-mock": "^7.3.1",
"@types/getopts": "^2.0.1",
"@types/glob": "^7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"execa": "^1.0.0",
"execa": "^3.2.0",
"exit-hook": "^2.2.0",
"getopts": "^2.2.5",
"moment": "^2.20.1",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-dev-utils/src/proc_runner/proc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
cwd,
env,
stdio: ['pipe', 'pipe', 'pipe'],
preferLocal: true,
});

if (stdin) {
Expand Down
7 changes: 2 additions & 5 deletions packages/kbn-es-query/src/filters/__tests__/phrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ describe('Filter Manager', function () {
it('should return a match query filter when passed a standard field', function () {
const field = getField(indexPattern, 'bytes');
expected.query = {
match: {
bytes: {
query: 5,
type: 'phrase'
}
match_phrase: {
bytes: 5
}
};
expect(buildPhraseFilter(field, 5, indexPattern)).to.eql(expected);
Expand Down
10 changes: 9 additions & 1 deletion packages/kbn-es-query/src/filters/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ import { CustomFilter } from './custom_filter';
import { ExistsFilter, isExistsFilter } from './exists_filter';
import { GeoBoundingBoxFilter, isGeoBoundingBoxFilter } from './geo_bounding_box_filter';
import { GeoPolygonFilter, isGeoPolygonFilter } from './geo_polygon_filter';
import { PhraseFilter, isPhraseFilter, isScriptedPhraseFilter } from './phrase_filter';
import {
PhraseFilter,
isPhraseFilter,
isScriptedPhraseFilter,
getPhraseFilterField,
getPhraseFilterValue,
} from './phrase_filter';
import { PhrasesFilter, isPhrasesFilter } from './phrases_filter';
import { QueryStringFilter, isQueryStringFilter } from './query_string_filter';
import {
Expand All @@ -48,6 +54,8 @@ export {
PhraseFilter,
isPhraseFilter,
isScriptedPhraseFilter,
getPhraseFilterField,
getPhraseFilterValue,
PhrasesFilter,
isPhrasesFilter,
QueryStringFilter,
Expand Down
28 changes: 25 additions & 3 deletions packages/kbn-es-query/src/filters/lib/phrase_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { get } from 'lodash';
import { get, isPlainObject } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';

export type PhraseFilterMeta = FilterMeta & {
Expand All @@ -36,8 +36,30 @@ export type PhraseFilter = Filter & {
meta: PhraseFilterMeta;
};

export const isPhraseFilter = (filter: any): filter is PhraseFilter =>
filter && (filter.query && filter.query.match);
type PhraseFilterValue = string | number | boolean;

export const isPhraseFilter = (filter: any): filter is PhraseFilter => {
const isMatchPhraseQuery = filter && filter.query && filter.query.match_phrase;

const isDeprecatedMatchPhraseQuery =
filter &&
filter.query &&
filter.query.match &&
Object.values(filter.query.match).find((params: any) => params.type === 'phrase');

return !!(isMatchPhraseQuery || isDeprecatedMatchPhraseQuery);
};

export const isScriptedPhraseFilter = (filter: any): filter is PhraseFilter =>
Boolean(get(filter, 'script.script.params.value'));

export const getPhraseFilterField = (filter: PhraseFilter) => {
const queryConfig = filter.query.match_phrase || filter.query.match;
return Object.keys(queryConfig)[0];
};

export const getPhraseFilterValue = (filter: PhraseFilter): PhraseFilterValue => {
const queryConfig = filter.query.match_phrase || filter.query.match;
const queryValue = Object.values(queryConfig)[0] as any;
return isPlainObject(queryValue) ? queryValue.query : queryValue;
};
7 changes: 2 additions & 5 deletions packages/kbn-es-query/src/filters/phrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ export function buildPhraseFilter(field, value, indexPattern) {
filter.script = getPhraseScript(field, value);
filter.meta.field = field.name;
} else {
filter.query = { match: {} };
filter.query.match[field.name] = {
query: convertedValue,
type: 'phrase'
};
filter.query = { match_phrase: {} };
filter.query.match_phrase[field.name] = convertedValue;
}
return filter;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"del": "^4.1.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"getopts": "^2.2.4",
"glob": "^7.1.2",
"node-fetch": "^2.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"execa": "^1.0.0",
"execa": "^3.2.0",
"getopts": "^2.2.4",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"argv-split": "^2.0.1",
"commander": "^3.0.0",
"del": "^4.1.1",
"execa": "^1.0.0",
"execa": "^3.2.0",
"globby": "^8.0.1",
"gulp-babel": "^8.0.0",
"gulp-rename": "1.4.0",
Expand Down
Loading

0 comments on commit 7d5347a

Please sign in to comment.