Fixes https://github.com/elastic/kibana/issues/157219
On the client, `URLSearchParams.set` encodes strings. On the server,
`query` values are passed to the route decoded. Therefore, there is no
need for special encoding or decoding of requestBody, other then rison
encoding.
PR creates `getTileUrlParams` to standardize vector tile URL creation
across sources. `getTileUrlParams` is placed in a package so it can be
used in integration tests. This greatly increases the maintainability of
integration tests as it makes them ore readable and creates tileUrls
just like the client does to ensure testing is as close to the real
thing as possible.
PR also updates getTileUrl generation to only pick requestBody keys used
by vector tile routes to avoid sending unnecessary data to the server.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
https://github.com/elastic/kibana/issues/153218
Existing execution context implementation spread results from
`executionContextServiceStart().get()` to add map `id`. This
implementation did not work when map was embedded in another
application. When embedded, `executionContextServiceStart().get()`
returned the `id` of the parent application and not the `id` for the
map.
This PR resolves the issue by building executionContext directly in
MapEmbeddable and MapApp. MapApp uses `savedObjectId` for
`executionContext.id`. MapEmbeddable uses `embeddableId` for
`executionContext.id`.
The PR also updates the MVT routes to include executionContextId for the
execution context with `_mvt` calls.
#### Testing
To view execution context in kibana logs, add below to kibana.dev.yml.
For more information
https://www.elastic.co/guide/en/kibana/8.7/kibana-troubleshooting-trace-query.html
```
logging:
loggers:
- name: execution_context
level: debug
appenders: [console]
```
#### Execution context for lens and maps panels in dashboard
There is not a lot of consistency for what `type` and `name` should be
across Kibana. I found [this
comment](https://github.com/elastic/kibana/pull/105206/files#r671174649)
for when lens added execution context for lens embeddable that stated
`type:feature` and `name:sub_feature`. Therefore, I followed the lens
example and made `type:maps` and `name:maps` since maps does not have
sub_features.
```
[2023-03-23T18:29:12.750-06:00][DEBUG][execution_context]
{"type":"application","name":"dashboards","url":"/mth/app/dashboards","page":"app","id":"d98e6530-c9a8-11ed-9340-d743c2c88db8","child":{"type":"maps","name":"maps","id":"91f17723-367d-460e-ad90-dbac1fc072cb","url":"/map/de71f4f0-1902-11e9-919b-ffe5949a18d2","description":"es_geo_grid_source:cluster"}}
[2023-03-23T18:29:12.750-06:00][DEBUG][execution_context]
{"type":"application","name":"dashboards","url":"/mth/app/dashboards","page":"app","id":"d98e6530-c9a8-11ed-9340-d743c2c88db8","child":{"type":"maps","name":"maps","id":"91f17723-367d-460e-ad90-dbac1fc072cb","url":"/map/de71f4f0-1902-11e9-919b-ffe5949a18d2","description":"es_term_source:terms"}}
[2023-03-23T18:29:13.241-06:00][DEBUG][execution_context]
{"type":"dashboard","name":"dashboards","url":"/mth/app/dashboards","page":"app","id":"d98e6530-c9a8-11ed-9340-d743c2c88db8","description":"single
map","child":{"type":"lens","name":"lnsXY","id":"b9e44118-9e67-4c1c-9159-597d8a9f80d1","description":"lens","url":"/mth/app/lens#/edit/32e87880-c9ab-11ed-9340-d743c2c88db8"}}
```
#### Execution context for maps
There is not a lot of consistency across kibana for `type` and `name` in applications. [ExecutionContextService.getDefaultContext](https://github.com/elastic/kibana/blob/main/packages/core/execution-context/core-execution-context-browser-internal/src/execution_context_service.ts#L99) returns the below so I stuck with `application` for type in client and `server` for type in server. Here is [one more link](https://github.com/elastic/kibana/pull/124996) that provides some context value of `name` property.
```
return {
type: 'application',
name: this.appId,
url: window.location.pathname,
};
```
```
[2023-03-23T18:30:39.886-06:00][DEBUG][execution_context]
{"type":"application","name":"maps","url":"/mth/app/maps/map/de71f4f0-1902-11e9-919b-ffe5949a18d2","id":"de71f4f0-1902-11e9-919b-ffe5949a18d2","page":"editor","description":"es_geo_grid_source:cluster"}
[2023-03-23T18:30:39.886-06:00][DEBUG][execution_context]
{"type":"application","name":"maps","url":"/mth/app/maps/map/de71f4f0-1902-11e9-919b-ffe5949a18d2","id":"de71f4f0-1902-11e9-919b-ffe5949a18d2","page":"editor","description":"es_term_source:terms"}
```
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Fixes https://github.com/elastic/kibana/issues/150184
PR updates vector tile search request body generation to only populate
`sort` property when its provided. PR also cleans up some `any` types
with types from elasticsearch client.
* [maps] mvt labels
* eslint
* only request labels when needed
* update vector tile integration tests for hasLabels parameter
* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'
* fix tests
* fix test
* only add _mvt_label_position filter when vector tiles are from ES vector tile search API
* review feedback
* include hasLabels in source data
* fix jest test
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [maps] Vector tile inspector adapter
* empty prompt
* add layer select
* tile request view
* show gridTile es path and body
* show error message
* hits request
* tab with editor
* clean up
* open in console
* do not track same tile multiple times
* remove layer from vector tile inspector when layer is removed
* refactor tile request generation
* show path in inspector
* requests view callout
* remove duplicated server side code
* remove unused files
* fix map_actions test
* open requests view when getting requests from inspector
* only show view when adapter is present
* fix open in console link not matching tile request
* tslint
* fix search sessions functional test
* update trouble shooting docs
* use bold in docs
* fix tiles at zoom level 0
* revert changes to mb_map
* include path when copying to clipboard
* clear inspector when layer type changes
* tslint fix
* clean-up
* update callout copy
* empty prompt copy
* copy updates
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Use content-encoding header from ES for mvt
We can't always assume the content-encoding will be gzip. When SSL is enabled in Elasticsearch, the http.compression is disabled by default. We can use the headers from the Elasticsearch response to form the Kibana response.
You should have HTTPS enabled to test this PR. Use `yarn es snapshot --ssl` and `yarn start --ssl`.
* Client side execution app level context propagation
* context$ + apm rum integration
* invert the context parent \ child relationship (cc @mikhail)
move more things to top level context
* Pass down context to apm on server
* types
* eslint
* parent <> child
* docs + eslint + jest
* execution context mock
* eslint
* jest
* jest
* server jest
* check
* jest
* storybook
* jest
* report the current space
* fix server side context container
* Remove spaces for now
* docssss
* jest
* lint
* test
* docs
* revert file
* doc
* all context params are optional
* clear on page change
* lint
* ts
* skipped test again
* testing fixes
* oops
* code review #1
* code review #2
* getAsLabels
* maps inherit dashboard context
* docs
* ts
* Give common context to all vis editors
* fix test
* ts \ es \ tests
* labels
* missing types
* docsy docs
* cr #3
* improve jest
* Use editor name
* Update src/plugins/visualizations/public/visualize_app/components/visualize_editor.tsx
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
* fix maps context
* jest tests for maps
* cr
* docs
* Update execution_context.test.ts
* docs
* lint
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
* use interpolate instead of modifing geojson
* update mbMap._queryForMeta to support HeatmapLayer
* syncMvtSourceData
* vector source
* gridPrecision
* allow seleting super fine
* removeStaleMbSourcesAndLayers
* clean up
* fix tests
* linter
* i18n fixes and update jest snapshots
* move mtv sync source tests from mvt_vector_layer to sync_source_data test suite
* clean up test
* eslint
* review feedback
* update test expects
* properly fix test expects
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* tmp
* tmp
* tmp
* tmp
* tmp
* use es naming
* typo
* organize files for clarity
* plugin for hits
* tmp
* initial styling
* more boilerplate
* tmp
* temp
* add size support
* remove junk
* tooltip
* edits
* too many features
* rename for clarity
* typing
* tooltip improvements
* icon
* callouts
* align count handling
* typechecks
* i18n
* tmp
* type fixes
* linting
* convert to ts and disable option
* readd test dependencies
* typescheck
* update yarn lock
* fix typecheck
* update snapshot
* fix snapshot
* fix snapshot
* fix snapshot
* fix snapshot
* fix test
* fix tests
* fix test
* add key
* fix integration test
* move test
* use centroid placement
* more text fixes
* more test fixes
* Remove top terms aggregations when switching to super fine resolution (#114667)
* [Maps] MVT metrics
* remove js file
* updateSourceProps
* i18n cleanup
* mvt labels
* remove isPointsOnly from IVectorSource interface
* move get_centroid_featues to vector_layer since its no longer used in server
* labels
* warn users when selecting scaling type that does not support term joins
* clean up scaling_form
* remove IField.isCountable method
* move pluck code from common to dynamic_style_property
* move convert_to_geojson to es_geo_grid_source folder
* remove getMbFeatureIdPropertyName from IVectorLayer
* clean up cleanTooltipStateForLayer
* use euiWarningColor for too many features outline
* update jest snapshots and eslint fixes
* update docs for incomplete data changes
* move tooManyFeatures MB layer definition from VectorLayer to TiledVectorLayer, clean up VectorSource interface
* remove commented out filter in tooltip_control add api docs for getMbLayerIds and getMbTooltipLayerIds
* revert changing getSourceTooltipContent to getSourceTooltipConfigFromGeoJson
* replace DEFAULT_MAX_RESULT_WINDOW with loading maxResultWindow as data request
* clean up
* eslint
* remove unused constants from Kibana MVT implemenation and tooManyFeaturesImage
* add better should method for tiled_vector_layer.getCustomIconAndTooltipContent jest test
* fix tooltips not being displayed for super-fine clusters and grids
* fix check in getFeatureId for es_Search_sources only
* eslint, remove __kbn_metadata_feature__ filter from mapbox style expects
* remove geoFieldType paramter for tile API
* remove searchSessionId from MVT url since its no longer used
* tslint
* vector tile scaling option copy update
* fix getTile and getGridTile API integration tests
* remove size from _mvt request body, size provided in query
* eslint, fix test expect
* stablize jest test
* track total hits for _mvt request
* track total hits take 2
* align vector tile copy
* eslint
* revert change to EsSearchSource._loadTooltipProperties with regards to handling undefined _index. MVT now provides _index
* clean up
* only send metric aggregations to mvt/getGridTile endpoint
* update snapshot, update getGridTile URLs in tests
* update request URL for getGridTile
* eslint
Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* bump @elastic/elasticsearch to canary.7
* address errors in core
* address errors in data plugin
* address errors in Alerting team plugins
* remove outdated messages in Lens
* remove unnecessary comments in ML
* address errors in Observability plugin
* address errors in reporting plugin
* address errors in Rule registry plugin
* fix errors in Security plugins
* fix errors in ES-UI plugin
* remove unnecessary union.
* update core tests
* fix kbn-es-archiver
* update to canary 8
* bump to v9
* use new typings
* fix new errors in core
* fix errors in core typeings
* fix type errors in data plugin
* fix type errors in telemetray plugin
* fix data plugin tests
* fix search examples type error
* fix errors in discover plugin
* fix errors in index_pattern_management
* fix type errors in vis_type_*
* fix errors in typings/elasticsearch
* fix type errors in actions plugin
* fix type errors in alerting and apm plugins
* fix type errors in canvas and cases
* fix errors in event_log
* fix type errors in ILM and ingest_pipelines
* fix errors in lens plugin
* fix errors in lists plugin
* fix errors in logstash
* fix errors in metrics_entities
* fix errors in o11y
* fix errors in watcher
* fix errors in uptime
* fix errors in upgrade_assistant
* fix errors in task_manager
* fix errors in stack_alerts
* fix errors in security_solution
* fix errors in rule_registry
* fix errors in snapshot_restore
* fix remaining errors
* fix search intergration tests
* adjust assetion
* bump version to canary.10
* adapt code to new naming schema
* use mapping types provided by the client library
* Revert "adjust assetion"
This reverts commit 19b8fe0464.
* fix so intergration tests
* fix http integration tests
* bump version to canary 11
* fix login test
* fix http integration test
* fix apm test
* update docs
* fixing some ml types
* fix new errors in data plugin
* fix new errors in alerting plugin
* fix new errors in lists plugin
* fix new errors in reporting
* fix or mute errors in rule_registry plugin
* more ML type fixes
* bump to canary 12
* fix errors after merge conflict
* additional ML fixes
* bump to canary 13
* fix errors in apm plugin
* fix errors in fleet plugin
* fix errors in infra plugin
* fix errors in monitoring plugin
* fix errors in osquery plugin
* fix errors in security solution plugins
* fix errors in transform plugin
* Update type imports for ES
* fix errors in x-pack plugins
* fix errors in tests
* update docs
* fix errors in x-pack/test
* update error description
* fix errors after master merge
* update comment in infra plugin
* fix new errors on xpack tests/
Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
* [Maps] do not track total hits for elasticsearch search requests
* set track_total_hits for es_search_source tooltip fetch
* tslint
* searchSource doc updates, set track_total_hits in MVT requests
* revert changes made to searchsourcefields docs
* tslint
* review feedback
* tslint
* remove Hits (Total) from functional tests
* remove sleep in functional test
* tslint
* fix method name
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Use client from branch
* Get type checking working in core
* Fix types in other plugins
* Update client types + remove type errors from core
* migrate Task Manager Elasticsearch typing from legacy library to client library
* use SortOrder instead o string in alerts
* Update client types + fix core type issues
* fix maps ts errors
* Update Lens types
* Convert Search Profiler body from a string to an object to conform to SearchRequest type.
* Fix SOT types
* Fix/mute Security/Spaces plugins type errors.
* Fix bootstrap types
* Fix painless_lab
* corrected es typing in Event Log
* Use new types from client for inferred search responses
* Latest type defs
* Integrate latest type defs for APM/UX
* fix core errors
* fix telemetry errors
* fix canvas errors
* fix data_enhanced errors
* fix event_log errors
* mute lens errors
* fix or mute maps errors
* fix reporting errors
* fix security errors
* mute errors in task_manager
* fix errors in telemetry_collection_xpack
* fix errors in data plugins
* fix errors in alerts
* mute errors in index_management
* fix task_manager errors
* mute or fix lens errors
* fix upgrade_assistant errors
* fix or mute errors in index_lifecycle_management
* fix discover errors
* fix core tests
* ML changes
* fix core type errors
* mute error in kbn-es-archiver
* fix error in data plugin
* fix error in telemetry plugin
* fix error in discover
* fix discover errors
* fix errors in task_manager
* fix security errors
* fix wrong conflict resolution
* address errors with upstream code
* update deps to the last commit
* remove outdated comments
* fix core errors
* fix errors after update
* adding more expect errors to ML
* pull the lastest changes
* fix core errors
* fix errors in infra plugin
* fix errors in uptime plugin
* fix errors in ml
* fix errors in xpack telemetry
* fix or mute errors in transform
* fix errors in upgrade assistant
* fix or mute fleet errors
* start fixing apm errors
* fix errors in osquery
* fix telemetry tests
* core cleanup
* fix asMutableArray imports
* cleanup
* data_enhanced cleanup
* cleanup events_log
* cleaup
* fix error in kbn-es-archiver
* fix errors in kbn-es-archiver
* fix errors in kbn-es-archiver
* fix ES typings for Hit
* fix SO
* fix actions plugin
* fix fleet
* fix maps
* fix stack_alerts
* fix eslint problems
* fix event_log unit tests
* fix failures in data_enhanced tests
* fix test failure in kbn-es-archiver
* fix test failures in index_pattern_management
* fixing ML test
* remove outdated comment in kbn-es-archiver
* fix error type in ml
* fix eslint errors in osquery plugin
* fix runtime error in infra plugin
* revert changes to event_log cluser exist check
* fix eslint error in osquery
* fixing ML endpoint argument types
* fx types
* Update api-extractor docs
* attempt fix for ese test
* Fix lint error
* Fix types for ts refs
* Fix data_enhanced unit test
* fix lens types
* generate docs
* Fix a number of type issues in monitoring and ml
* fix triggers_actions_ui
* Fix ILM functional test
* Put search.d.ts typings back
* fix data plugin
* Update typings in typings/elasticsearch
* Update snapshots
* mute errors in task_manager
* mute fleet errors
* lens. remove unnecessary ts-expect-errors
* fix errors in stack_alerts
* mute errors in osquery
* fix errors in security_solution
* fix errors in lists
* fix errors in cases
* mute errors in search_examples
* use KibanaClient to enforce promise-based API
* fix errors in test/ folder
* update comment
* fix errors in x-pack/test folder
* fix errors in ml plugin
* fix optional fields in ml api_integartoon tests
* fix another casting problem in ml tests
* fix another ml test failure
* fix fleet problem after conflict resolution
* rollback changes in security_solution. trying to fix test
* Update type for discover rows
* uncomment runtime_mappings as its outdated
* address comments from Wylie
* remove eslint error due to any
* mute error due to incompatibility
* Apply suggestions from code review
Co-authored-by: John Schulz <github.com@jfsiii.org>
* fix type error in lens tests
* Update x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
* Update x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
* update deps
* fix errors in core types
* fix errors for the new elastic/elasticsearch version
* remove unused type
* remove unnecessary manual type cast and put optional chaining back
* ML: mute Datafeed is missing indices_options
* Apply suggestions from code review
Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
* use canary pacakge instead of git commit
Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
Co-authored-by: CJ Cenizal <cj@cenizal.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: restrry <restrry@gmail.com>
Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: John Schulz <github.com@jfsiii.org>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
* [Maps] clamp MVT too many features polygon to tile boundary
* add mapbox_styles to index.js
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [data.search] Add search session methods to search service contract
* Fix types
* Fix tests and switch to cancel
* Update docs
* Fix types/tests
* Fix tests
* Update status of SO before cancelling search requests
* Add API integration test
* Fix types
* Update expiration route to use config defaultExpiration
* Fix test
* Update docs
* New logic for extend
* Remove declare module
* Review feedback
* fix ts
* Remove test that is no longer valid
* Fix undefined bug
* Use DataRequestHandlerContext in maps
* ts
Co-authored-by: Liza K <liza.katz@elastic.co>
* [Maps] migrate mvt routes to use data.search service instead of directly calling elasticsearch
* pass search session id to mvt requests
* move grid tile tests to integration tests
* replace getTile unit test with integration test
* add comment about request param
* revert total meta change
* tslint fixes
* update jest tests
* [Maps] labels for polygons and lines
* remove x-pack yarn.lock
* add labels to choropleth map wizard
* clean up comment
* add mvt tile support
* only add centroids if there may be lines or polygons
* tslint
* tslint
* do not add centroid to too many features polygon
* update get_tile expect statements
* move turf dependencies from devDependencies to dependencies
* update jest snapshot and functional test expects
* fix functional test expect
* another functional test expect update
* functional test updates
* expect
* pew pew source expect updates
* update joins expect
* update mapbox style expects
* update join visibility expects for geocentroids
* update join visibility expects for geocentroids
* another functional test expect update
* review feedback
* update yarn.lock
* tslint
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>