Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] handle case where fit to bounds does not match any documents #66307

Merged
merged 2 commits into from
May 13, 2020

Conversation

nreese
Copy link
Contributor

@nreese nreese commented May 12, 2020

fixes #67500

Steps to view bug:

  1. install web logs sample data and create map with Documents layer
  2. set time range to 9 months into future so there are no matching documents
  3. hit fit to bounds button

Screen Shot 2020-05-12 at 2 39 55 PM

Empty geo_bounds aggregation response
Screen Shot 2020-05-12 at 2 30 07 PM

This PR fixes the above bug by properly handling the case where there are no matching documents and therefore no bounds can be calculaged.

@nreese nreese requested a review from thomasneirynck May 12, 2020 20:34
@nreese nreese requested a review from a team as a code owner May 12, 2020 20:34
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

@@ -163,16 +163,12 @@ export class AbstractESSource extends AbstractVectorSource {
const esResp = await searchSource.fetch();
esBounds = _.get(esResp, 'aggregations.fitToBounds.bounds');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than keep hiding the root-cause, could we remove use of lodash here?

 esBonds = aggregations.fitToBounds.bounds ? aggregations.fitToBounds.bounds : null;

or

if (!aggregations.fitToBounds.bounds) {
    return null;
} 
esBounds = aggregations.fitToBounds.bounds;

which helps clarity

@nreese nreese merged commit 9e0504e into elastic:master May 13, 2020
nreese added a commit to nreese/kibana that referenced this pull request May 13, 2020
…lastic#66307)

* [Maps] handle case where fit to bounds does not match any documents

* review feedback
nreese added a commit to nreese/kibana that referenced this pull request May 13, 2020
…lastic#66307)

* [Maps] handle case where fit to bounds does not match any documents

* review feedback
# Conflicts:
#	x-pack/plugins/maps/public/classes/sources/es_source/es_source.js
v1v added a commit to v1v/kibana that referenced this pull request May 13, 2020
* upstream/master: (223 commits)
  [Ingest] Support root level yaml variables in agent stream template (elastic#66120)
  [Snapshot Restore] Fix error when deleting snapshots behind reverse proxy (elastic#66147)
  [Lens] fix empty state for pie (elastic#66206)
  [APM] Improve e2e tests (elastic#66373)
  [ML] Data Frame Analytics: Fix steps to be named phases. (elastic#65855)
  [Discover] Encode context link filter part (elastic#63831)
  [APM] Scope APM alert creation to environment (elastic#65681)
  Move Kibana Usage collectors outside the telemetry plugin (elastic#65663)
  [ML] Data Frame Analytics: Fix confusion matrix data grid width. (elastic#65818)
  Switch to core application service (elastic#63443)
  Removes use of prefer_v2_templates (elastic#66316)
  [Maps] handle case where fit to bounds does not match any documents (elastic#66307)
  log error instead of throw (elastic#66254)
  [plugin-helpers] remove outdated postinstall task (elastic#66324)
  Spaces - migrate default space and enter space view to KP (elastic#66098)
  [APM] Change plugin id for `apm_oss` to `apmOss` (elastic#66164)
  [Maps] convert map_selectors to TS (elastic#65905)
  [uptime/usage-collector] add missing await (elastic#66079)
  [Ingest] Add additional attributes to the Datasources Saved Object (elastic#66127)
  [Endpoint]EMT-339: add new policy response schema (elastic#66264)
  ...
nreese added a commit that referenced this pull request May 13, 2020
…66307) (#66342)

* [Maps] handle case where fit to bounds does not match any documents

* review feedback
nreese added a commit that referenced this pull request May 13, 2020
…66307) (#66344)

* [Maps] handle case where fit to bounds does not match any documents

* review feedback
# Conflicts:
#	x-pack/plugins/maps/public/classes/sources/es_source/es_source.js
@kibanamachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps


Test Failures

Kibana Pipeline / kibana-xpack-agent / X-Pack API Integration Tests.x-pack/test/api_integration/apis/endpoint/policy·ts.apis Endpoint plugin Endpoint policy api GET /api/endpoint/policy_response "before all" hook for "should return one policy response for host"

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 1 times on tracked branches: https://dryrun

[00:00:00]       │
[00:00:00]         └-: apis
[00:00:00]           └-> "before all" hook
[00:09:51]           └-: Endpoint plugin
[00:09:51]             └-> "before all" hook
[00:09:51]             └-> "before all" hook
[00:09:56]             └-: Endpoint policy api
[00:09:56]               └-> "before all" hook
[00:09:56]               └-: GET /api/endpoint/policy_response
[00:09:56]                 └-> "before all" hook
[00:09:56]                 └-> "before all" hook
[00:09:56]                   │ info [endpoint/policy] Loading "mappings.json"
[00:09:56]                   │ info [endpoint/policy] Loading "data.json.gz"
[00:09:56]                   └- ✖ fail: "apis Endpoint plugin Endpoint policy api GET /api/endpoint/policy_response "before all" hook for "should return one policy response for host""
[00:09:56]                   │

Stack Trace

{ Error: [illegal_argument_exception] unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
    at respond (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/transport.js:349:15)
    at checkRespForFailure (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/transport.js:306:7)
    at HttpConnector.<anonymous> (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)
    at IncomingMessage.wrapper (/dev/shm/workspace/kibana/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  status: 400,
  displayName: 'BadRequest',
  message:
   '[illegal_argument_exception] unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings',
  path: '/metrics-endpoint.policy-default-1',
  query: {},
  body:
   { error:
      { root_cause: [Array],
        type: 'illegal_argument_exception',
        reason:
         'unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings' },
     status: 400 },
  statusCode: 400,
  response:
   '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}],"type":"illegal_argument_exception","reason":"unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},"status":400}',
  toString: [Function],
  toJSON: [Function] }

Kibana Pipeline / kibana-xpack-agent / X-Pack API Integration Tests.x-pack/test/api_integration/apis/endpoint/policy·ts.apis Endpoint plugin Endpoint policy api GET /api/endpoint/policy_response "before all" hook for "should return one policy response for host"

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]       │
[00:00:00]         └-: apis
[00:00:00]           └-> "before all" hook
[00:10:52]           └-: Endpoint plugin
[00:10:52]             └-> "before all" hook
[00:10:52]             └-> "before all" hook
[00:10:58]             └-: Endpoint policy api
[00:10:58]               └-> "before all" hook
[00:10:58]               └-: GET /api/endpoint/policy_response
[00:10:58]                 └-> "before all" hook
[00:10:58]                 └-> "before all" hook
[00:10:58]                   │ info [endpoint/policy] Loading "mappings.json"
[00:10:58]                   │ info [endpoint/policy] Loading "data.json.gz"
[00:10:58]                   └- ✖ fail: "apis Endpoint plugin Endpoint policy api GET /api/endpoint/policy_response "before all" hook for "should return one policy response for host""
[00:10:58]                   │

Stack Trace

{ Error: [illegal_argument_exception] unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
    at respond (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/transport.js:349:15)
    at checkRespForFailure (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/transport.js:306:7)
    at HttpConnector.<anonymous> (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)
    at IncomingMessage.wrapper (/dev/shm/workspace/kibana/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  status: 400,
  displayName: 'BadRequest',
  message:
   '[illegal_argument_exception] unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings',
  path: '/metrics-endpoint.policy-default-1',
  query: {},
  body:
   { error:
      { root_cause: [Array],
        type: 'illegal_argument_exception',
        reason:
         'unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings' },
     status: 400 },
  statusCode: 400,
  response:
   '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}],"type":"illegal_argument_exception","reason":"unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},"status":400}',
  toString: [Function],
  toJSON: [Function] }

Kibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/reporting_management/report_delete_pagination·ts.reporting management app Delete reports "before all" hook for "Confirm single report deletion works"

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]       │
[00:37:10]         └-: reporting management app
[00:37:10]           └-> "before all" hook
[00:37:10]           └-: Delete reports
[00:37:10]             └-> "before all" hook
[00:37:10]             └-> "before all" hook
[00:37:10]               │ debg set roles = global_discover_read,reporting_user
[00:37:10]               │ debg creating user test_user
[00:37:10]               │ info [o.e.x.s.a.u.TransportPutUserAction] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] updated user [test_user]
[00:37:10]               │ debg created user test_user
[00:37:10]               │ debg TestSubjects.exists(kibanaChrome)
[00:37:10]               │ debg Find.existsByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=2500
[00:37:11]               │ debg TestSubjects.find(kibanaChrome)
[00:37:11]               │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=100000
[00:37:11]               │ debg browser[INFO] http://localhost:6181/app/kibana?_t=1590597394229#/management/elasticsearch/index_lifecycle_management/policies 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:37:11]               │
[00:37:11]               │ debg browser[INFO] http://localhost:6181/bundles/app/kibana/bootstrap.js 10:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:37:14]               │ debg browser[INFO] http://localhost:6181/33128/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-05-27T16:36:45Z
[00:37:14]               │        Adding connection to http://localhost:6181/elasticsearch
[00:37:14]               │
[00:37:14]               │      "
[00:37:14]               │ info [empty_kibana] Loading "mappings.json"
[00:37:14]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana_2/SFOQhgysQ2KD9AJWxzB6wg] deleting index
[00:37:14]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana_1/tSFTQXjATIuEwtwVPvunYQ] deleting index
[00:37:14]               │ info [empty_kibana] Deleted existing index [".kibana_2",".kibana_1"]
[00:37:14]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:37:14]               │ info [empty_kibana] Created index ".kibana"
[00:37:14]               │ debg [empty_kibana] ".kibana" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:37:14]               │ERROR browser[SEVERE] http://localhost:6181/api/index_lifecycle_management/policies - Failed to load resource: the server responded with a status of 403 (Forbidden)
[00:37:14]               │ERROR browser[SEVERE] http://localhost:6181/api/saved_objects/_bulk_get - Failed to load resource: the server responded with a status of 403 (Forbidden)
[00:37:14]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana/0-_hbEoLT5OBcVlpHkbaVg] update_mapping [_doc]
[00:37:14]               │ debg Migrating saved objects
[00:37:14]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana/0-_hbEoLT5OBcVlpHkbaVg] update_mapping [_doc]
[00:37:14]               │ debg browser[INFO] http://localhost:6181/33128/bundles/commons.bundle.js 2:1149272 "Detected an unhandled Promise rejection.
[00:37:14]               │      Error: Forbidden"
[00:37:14]               │ERROR browser[SEVERE] http://localhost:6181/33128/bundles/commons.bundle.js 2:366937 
[00:37:15]               │ proc [kibana]   log   [16:36:47.446] [info][savedobjects-service] Creating index .kibana_2.
[00:37:15]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana_2] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:37:15]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] updating number_of_replicas to [0] for indices [.kibana_2]
[00:37:15]               │ proc [kibana]   log   [16:36:47.532] [info][savedobjects-service] Reindexing .kibana to .kibana_1
[00:37:15]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:37:15]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] updating number_of_replicas to [0] for indices [.kibana_1]
[00:37:15]               │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] 62106 finished with response BulkByScrollResponse[took=16ms,timed_out=false,sliceId=null,updated=0,created=1,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:37:15]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana/0-_hbEoLT5OBcVlpHkbaVg] deleting index
[00:37:15]               │ proc [kibana]   log   [16:36:47.905] [info][savedobjects-service] Migrating .kibana_1 saved objects to .kibana_2
[00:37:15]               │ proc [kibana]   log   [16:36:47.919] [info][savedobjects-service] Pointing alias .kibana to .kibana_2.
[00:37:16]               │ proc [kibana]   log   [16:36:47.966] [info][savedobjects-service] Finished in 521ms.
[00:37:16]               │ debg applying update to kibana config: {"accessibility:disableAnimations":true,"dateFormat:tz":"UTC"}
[00:37:16]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xl-1590592686074505957] [.kibana_2/6gbDZRf_Rw2xTSXceKrvwA] update_mapping [_doc]
[00:37:16]               │ info [reporting/archived_reports] Loading "mappings.json"
[00:37:16]               │ info [reporting/archived_reports] Loading "data.json.gz"
[00:37:16]               │ info Taking screenshot "/dev/shm/workspace/kibana/x-pack/test/functional/screenshots/failure/reporting management app Delete reports _before all_ hook.png"
[00:37:16]               │ info Current URL is: http://localhost:6181/app/kibana#/management/elasticsearch/index_lifecycle_management/policies
[00:37:17]               │ info Saving page source to: /dev/shm/workspace/kibana/x-pack/test/functional/failure_debug/html/reporting management app Delete reports _before all_ hook.html
[00:37:17]               └- ✖ fail: "reporting management app Delete reports "before all" hook for "Confirm single report deletion works""
[00:37:17]               │

Stack Trace

{ Error: [illegal_argument_exception] unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
    at respond (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/transport.js:349:15)
    at checkRespForFailure (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/transport.js:306:7)
    at HttpConnector.<anonymous> (/dev/shm/workspace/kibana/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)
    at IncomingMessage.wrapper (/dev/shm/workspace/kibana/node_modules/elasticsearch/node_modules/lodash/lodash.js:4929:19)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  status: 400,
  displayName: 'BadRequest',
  message:
   '[illegal_argument_exception] unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings',
  path: '/.reporting-2020.04.19',
  query: {},
  body:
   { error:
      { root_cause: [Array],
        type: 'illegal_argument_exception',
        reason:
         'unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings' },
     status: 400 },
  statusCode: 400,
  response:
   '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}],"type":"illegal_argument_exception","reason":"unknown setting [index.prefer_v2_templates] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},"status":400}',
  toString: [Function],
  toJSON: [Function] }

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fit to bounds without any matching any documents causes error
4 participants