Skip to content

[KQL] Skip slow wildcard checks when query is only *#96902

Merged
wylieconlon merged 4 commits intoelastic:masterfrom
wylieconlon:kql-improve-wildcard
Apr 20, 2021
Merged

[KQL] Skip slow wildcard checks when query is only *#96902
wylieconlon merged 4 commits intoelastic:masterfrom
wylieconlon:kql-improve-wildcard

Conversation

@wylieconlon
Copy link
Copy Markdown
Contributor

KQL uses a very slow regular expression to validate fields for wildcard queries, but for some reason this slow test was being applied when the query was empty or *, which are both special cases. This looks like it has been happening in every version of Kibana since we introduced support for Nested type fields in KQL.

Checklist

Delete any items that are not applicable to this PR.

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)


const isExistsQuery = valueArg.type === 'wildcard' && valueArg.value === wildcard.wildcardSymbol;
const isAllFieldsQuery =
fieldNameArg.type === 'wildcard' && fieldNameArg.value === wildcard.wildcardSymbol;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we were using fullFieldNameArg before, is that relevant ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ppisljar The fullFieldNameArg is only used when we are dealing with specific field wildcards, so for example nested.* would be matched by that logic. Since this case checks that the fieldName is exactly *, we can guarantee that there every field matches.

const isMatchAllQuery = isExistsQuery && isAllFieldsQuery;

if (isMatchAllQuery) {
if (isExistsQuery && fields && fields.length === indexPattern?.fields.length) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fields?.length

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

before we used OR betwen these conditions
wildcardStuff || fields.length === indexpatternfields.length

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, I will use an OR here. The special case that I missed, but was in the previous logic, is:

  1. There is no index pattern
  2. The query is a wildcard query
  3. It should shortcut and be a match_all

Copy link
Copy Markdown
Contributor

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM

@wylieconlon
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / Chrome UI Functional Tests.test/functional/apps/discover/_runtime_fields_editor·ts.discover app discover integration with runtime fields editor allows adding custom label to existing fields

Link to Jenkins

Standard Out

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

[00:00:00]       │
[00:07:48]         └-: discover app
[00:07:48]           └-> "before all" hook in "discover app"
[00:07:48]           └-> "before all" hook in "discover app"
[00:28:32]           └-: discover integration with runtime fields editor
[00:28:32]             └-> "before all" hook for "allows adding custom label to existing fields"
[00:28:32]             └-> "before all" hook for "allows adding custom label to existing fields"
[00:28:32]               │ info [discover] Loading "mappings.json"
[00:28:32]               │ info [discover] Loading "data.json"
[00:28:32]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_pre6.5.0_001/6P5r0t3TRG65yz6y9tCLsw] deleting index
[00:28:32]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/M3Sy_7-DSYGl1FK2DpY_jg] deleting index
[00:28:32]               │ info [discover] Deleted existing index ".kibana_8.0.0_001"
[00:28:32]               │ info [discover] Deleted existing index ".kibana_pre6.5.0_001"
[00:28:32]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana] creating index, cause [api], templates [], shards [1]/[1]
[00:28:32]               │ info [discover] Created index ".kibana"
[00:28:32]               │ debg [discover] ".kibana" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:28:32]               │ info [discover] Indexed 2 docs into ".kibana"
[00:28:32]               │ debg Migrating saved objects
[00:28:32]               │ proc [kibana]   log   [14:49:50.435] [info][savedobjects-service] [.kibana] INIT -> LEGACY_SET_WRITE_BLOCK. took: 3ms.
[00:28:32]               │ info [o.e.c.m.MetadataIndexStateService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] adding block write to indices [[.kibana/BgFMUxyETkOYE-GlNCJ4Mg]]
[00:28:32]               │ info [o.e.c.m.MetadataIndexStateService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] completed adding block write to indices [.kibana]
[00:28:32]               │ proc [kibana]   log   [14:49:50.460] [info][savedobjects-service] [.kibana] LEGACY_SET_WRITE_BLOCK -> LEGACY_CREATE_REINDEX_TARGET. took: 25ms.
[00:28:32]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_pre6.5.0_001] creating index, cause [api], templates [], shards [1]/[1]
[00:28:32]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] updating number_of_replicas to [0] for indices [.kibana_pre6.5.0_001]
[00:28:33]               │ proc [kibana]   log   [14:49:50.504] [info][savedobjects-service] [.kibana] LEGACY_CREATE_REINDEX_TARGET -> LEGACY_REINDEX. took: 44ms.
[00:28:33]               │ proc [kibana]   log   [14:49:50.509] [info][savedobjects-service] [.kibana] LEGACY_REINDEX -> LEGACY_REINDEX_WAIT_FOR_TASK. took: 5ms.
[00:28:33]               │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] 16916 finished with response BulkByScrollResponse[took=13.1ms,timed_out=false,sliceId=null,updated=0,created=2,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:28:33]               │ proc [kibana]   log   [14:49:50.614] [info][savedobjects-service] [.kibana] LEGACY_REINDEX_WAIT_FOR_TASK -> LEGACY_DELETE. took: 105ms.
[00:28:33]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana/BgFMUxyETkOYE-GlNCJ4Mg] deleting index
[00:28:33]               │ proc [kibana]   log   [14:49:50.642] [info][savedobjects-service] [.kibana] LEGACY_DELETE -> SET_SOURCE_WRITE_BLOCK. took: 28ms.
[00:28:33]               │ info [o.e.c.m.MetadataIndexStateService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] adding block write to indices [[.kibana_pre6.5.0_001/r3aeSWXpTMiMgB-d7TXlzg]]
[00:28:33]               │ info [o.e.c.m.MetadataIndexStateService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] completed adding block write to indices [.kibana_pre6.5.0_001]
[00:28:33]               │ proc [kibana]   log   [14:49:50.670] [info][savedobjects-service] [.kibana] SET_SOURCE_WRITE_BLOCK -> CREATE_REINDEX_TEMP. took: 28ms.
[00:28:33]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_reindex_temp] creating index, cause [api], templates [], shards [1]/[1]
[00:28:33]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] updating number_of_replicas to [0] for indices [.kibana_8.0.0_reindex_temp]
[00:28:33]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.kibana_8.0.0_reindex_temp][0]]])." previous.health="YELLOW" reason="shards started [[.kibana_8.0.0_reindex_temp][0]]"
[00:28:33]               │ proc [kibana]   log   [14:49:50.716] [info][savedobjects-service] [.kibana] CREATE_REINDEX_TEMP -> REINDEX_SOURCE_TO_TEMP. took: 46ms.
[00:28:33]               │ proc [kibana]   log   [14:49:50.721] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP -> REINDEX_SOURCE_TO_TEMP_WAIT_FOR_TASK. took: 5ms.
[00:28:33]               │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] 16955 finished with response BulkByScrollResponse[took=8.9ms,timed_out=false,sliceId=null,updated=0,created=2,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:28:33]               │ proc [kibana]   log   [14:49:50.827] [info][savedobjects-service] [.kibana] REINDEX_SOURCE_TO_TEMP_WAIT_FOR_TASK -> SET_TEMP_WRITE_BLOCK. took: 106ms.
[00:28:33]               │ info [o.e.c.m.MetadataIndexStateService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] adding block write to indices [[.kibana_8.0.0_reindex_temp/XBmXMzdYTzqR3pdqw5_m5g]]
[00:28:33]               │ info [o.e.c.m.MetadataIndexStateService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] completed adding block write to indices [.kibana_8.0.0_reindex_temp]
[00:28:33]               │ proc [kibana]   log   [14:49:50.853] [info][savedobjects-service] [.kibana] SET_TEMP_WRITE_BLOCK -> CLONE_TEMP_TO_TARGET. took: 26ms.
[00:28:33]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] applying create index request using existing index [.kibana_8.0.0_reindex_temp] metadata
[00:28:33]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001] creating index, cause [clone_index], templates [], shards [1]/[1]
[00:28:33]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] updating number_of_replicas to [0] for indices [.kibana_8.0.0_001]
[00:28:33]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/y-V1O4KpR3Gw4UzTp7-giw] create_mapping
[00:28:33]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.kibana_8.0.0_001][0]]])." previous.health="YELLOW" reason="shards started [[.kibana_8.0.0_001][0]]"
[00:28:33]               │ proc [kibana]   log   [14:49:50.918] [info][savedobjects-service] [.kibana] CLONE_TEMP_TO_TARGET -> OUTDATED_DOCUMENTS_SEARCH. took: 65ms.
[00:28:33]               │ proc [kibana]   log   [14:49:50.924] [info][savedobjects-service] [.kibana] OUTDATED_DOCUMENTS_SEARCH -> OUTDATED_DOCUMENTS_TRANSFORM. took: 6ms.
[00:28:33]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/y-V1O4KpR3Gw4UzTp7-giw] update_mapping [_doc]
[00:28:33]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/y-V1O4KpR3Gw4UzTp7-giw] update_mapping [_doc]
[00:28:34]               │ proc [kibana]   log   [14:49:51.877] [info][savedobjects-service] [.kibana] OUTDATED_DOCUMENTS_TRANSFORM -> OUTDATED_DOCUMENTS_SEARCH. took: 953ms.
[00:28:34]               │ proc [kibana]   log   [14:49:51.882] [info][savedobjects-service] [.kibana] OUTDATED_DOCUMENTS_SEARCH -> UPDATE_TARGET_MAPPINGS. took: 5ms.
[00:28:34]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/y-V1O4KpR3Gw4UzTp7-giw] update_mapping [_doc]
[00:28:34]               │ proc [kibana]   log   [14:49:51.908] [info][savedobjects-service] [.kibana] UPDATE_TARGET_MAPPINGS -> UPDATE_TARGET_MAPPINGS_WAIT_FOR_TASK. took: 26ms.
[00:28:34]               │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] 17015 finished with response BulkByScrollResponse[took=13.1ms,timed_out=false,sliceId=null,updated=2,created=0,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:28:34]               │ proc [kibana]   log   [14:49:52.012] [info][savedobjects-service] [.kibana] UPDATE_TARGET_MAPPINGS_WAIT_FOR_TASK -> MARK_VERSION_INDEX_READY. took: 104ms.
[00:28:34]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_reindex_temp/XBmXMzdYTzqR3pdqw5_m5g] deleting index
[00:28:34]               │ proc [kibana]   log   [14:49:52.034] [info][savedobjects-service] [.kibana] MARK_VERSION_INDEX_READY -> DONE. took: 22ms.
[00:28:34]               │ proc [kibana]   log   [14:49:52.035] [info][savedobjects-service] [.kibana] Migration completed after 1603ms
[00:28:34]               │ debg [discover] Migrated Kibana index after loading Kibana data
[00:28:34]               │ debg applying update to kibana config: {"accessibility:disableAnimations":true,"dateFormat:tz":"UTC","visualization:visualize:legacyChartsLibrary":true}
[00:28:34]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/y-V1O4KpR3Gw4UzTp7-giw] update_mapping [_doc]
[00:28:36]               │ info [logstash_functional] Loading "mappings.json"
[00:28:36]               │ info [logstash_functional] Loading "data.json.gz"
[00:28:36]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.22"
[00:28:36]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.20"
[00:28:36]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.21"
[00:28:37]               │ debg replacing kibana config doc: {"defaultIndex":"logstash-*","discover:searchFieldsFromSource":false}
[00:28:37]               │ debg discover
[00:28:37]               │ debg navigating to discover url: http://localhost:61231/app/discover#/
[00:28:37]               │ debg navigate to: http://localhost:61231/app/discover#/
[00:28:37]               │ debg browser[INFO] http://localhost:61231/app/discover?_t=1618930194906#/ 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:28:37]               │
[00:28:37]               │ debg browser[INFO] http://localhost:61231/bootstrap.js 41:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:28:37]               │ debg ... sleep(700) start
[00:28:38]               │ debg ... sleep(700) end
[00:28:38]               │ debg returned from get, calling refresh
[00:28:38]               │ debg browser[INFO] http://localhost:61231/app/discover?_t=1618930194906#/ 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:28:38]               │
[00:28:38]               │ debg browser[INFO] http://localhost:61231/bootstrap.js 41:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:28:38]               │ debg currentUrl = http://localhost:61231/app/discover#/
[00:28:38]               │          appUrl = http://localhost:61231/app/discover#/
[00:28:38]               │ debg TestSubjects.find(kibanaChrome)
[00:28:38]               │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:28:39]               │ debg ... sleep(501) start
[00:28:39]               │ debg ... sleep(501) end
[00:28:39]               │ debg in navigateTo url = http://localhost:61231/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(columns:!(),filters:!(),index:%27logstash-*%27,interval:auto,query:(language:kuery,query:%27%27),sort:!(!(%27@timestamp%27,desc)))
[00:28:39]               │ debg --- retry.try error: URL changed, waiting for it to settle
[00:28:40]               │ debg ... sleep(501) start
[00:28:40]               │ debg ... sleep(501) end
[00:28:40]               │ debg in navigateTo url = http://localhost:61231/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(columns:!(),filters:!(),index:%27logstash-*%27,interval:auto,query:(language:kuery,query:%27%27),sort:!(!(%27@timestamp%27,desc)))
[00:28:40]               │ debg TestSubjects.exists(statusPageContainer)
[00:28:40]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:28:43]               │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:28:43]               │ debg Setting absolute range to Sep 19, 2015 @ 06:31:44.000 to Sep 23, 2015 @ 18:31:44.000
[00:28:43]               │ debg TestSubjects.exists(superDatePickerToggleQuickMenuButton)
[00:28:43]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerToggleQuickMenuButton"]') with timeout=20000
[00:28:43]               │ debg TestSubjects.exists(superDatePickerShowDatesButton)
[00:28:43]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=2500
[00:28:43]               │ debg TestSubjects.click(superDatePickerShowDatesButton)
[00:28:43]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[00:28:43]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[00:28:43]               │ debg TestSubjects.exists(superDatePickerstartDatePopoverButton)
[00:28:43]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=2500
[00:28:44]               │ debg TestSubjects.click(superDatePickerendDatePopoverButton)
[00:28:44]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[00:28:44]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[00:28:44]               │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[00:28:44]               │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[00:28:44]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:28:44]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:28:44]               │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:28:44]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:44]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:44]               │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 23, 2015 @ 18:31:44.000)
[00:28:44]               │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:28:44]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:44]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:44]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1618927412217833399] [.kibana_8.0.0_001/y-V1O4KpR3Gw4UzTp7-giw] update_mapping [_doc]
[00:28:44]               │ debg TestSubjects.click(superDatePickerstartDatePopoverButton)
[00:28:44]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[00:28:44]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[00:28:44]               │ debg Find.waitForElementStale with timeout=10000
[00:28:45]               │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[00:28:45]               │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[00:28:45]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:28:45]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:28:45]               │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:28:45]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:45]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:45]               │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 19, 2015 @ 06:31:44.000)
[00:28:45]               │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:28:45]               │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:45]               │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:28:45]               │ debg TestSubjects.exists(superDatePickerApplyTimeButton)
[00:28:45]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerApplyTimeButton"]') with timeout=2500
[00:28:48]               │ debg --- retry.tryForTime error: [data-test-subj="superDatePickerApplyTimeButton"] is not displayed
[00:28:48]               │ debg TestSubjects.click(querySubmitButton)
[00:28:48]               │ debg Find.clickByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[00:28:48]               │ debg Find.findByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[00:28:48]               │ debg Find.waitForElementStale with timeout=10000
[00:28:48]               │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:28:48]               │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:28:48]             └-> allows adding custom label to existing fields
[00:28:48]               └-> "before each" hook: global before each for "allows adding custom label to existing fields"
[00:28:48]               │ debg TestSubjects.moveMouseTo(field-bytes)
[00:28:48]               │ debg TestSubjects.find(field-bytes)
[00:28:48]               │ debg Find.findByCssSelector('[data-test-subj="field-bytes"]') with timeout=10000
[00:28:50]               │ debg TestSubjects.click(fieldToggle-bytes)
[00:28:50]               │ debg Find.clickByCssSelector('[data-test-subj="fieldToggle-bytes"]') with timeout=10000
[00:28:50]               │ debg Find.findByCssSelector('[data-test-subj="fieldToggle-bytes"]') with timeout=10000
[00:28:51]               │ debg TestSubjects.click(field-bytes)
[00:28:51]               │ debg Find.clickByCssSelector('[data-test-subj="field-bytes"]') with timeout=10000
[00:28:51]               │ debg Find.findByCssSelector('[data-test-subj="field-bytes"]') with timeout=10000
[00:28:51]               │ debg TestSubjects.click(discoverFieldListPanelEdit-bytes)
[00:28:51]               │ debg Find.clickByCssSelector('[data-test-subj="discoverFieldListPanelEdit-bytes"]') with timeout=10000
[00:28:51]               │ debg Find.findByCssSelector('[data-test-subj="discoverFieldListPanelEdit-bytes"]') with timeout=10000
[00:28:51]               │ debg Find.findByClassName('indexPatternFieldEditor__form') with timeout=10000
[00:28:51]               │ debg TestSubjects.find(customLabelRow > toggle)
[00:28:51]               │ debg Find.findByCssSelector('[data-test-subj="customLabelRow"] [data-test-subj="toggle"]') with timeout=10000
[00:28:51]               │ debg updating checkbox customLabelRow > toggle from false to true
[00:28:51]               │ debg TestSubjects.click(customLabelRow > toggle)
[00:28:51]               │ debg Find.clickByCssSelector('[data-test-subj="customLabelRow"] [data-test-subj="toggle"]') with timeout=10000
[00:28:51]               │ debg Find.findByCssSelector('[data-test-subj="customLabelRow"] [data-test-subj="toggle"]') with timeout=10000
[00:28:52]               │ debg TestSubjects.setValue(customLabelRow > input, megabytes)
[00:28:52]               │ debg TestSubjects.click(customLabelRow > input)
[00:28:52]               │ debg Find.clickByCssSelector('[data-test-subj="customLabelRow"] [data-test-subj="input"]') with timeout=10000
[00:28:52]               │ debg Find.findByCssSelector('[data-test-subj="customLabelRow"] [data-test-subj="input"]') with timeout=10000
[00:28:52]               │ debg TestSubjects.click(fieldSaveButton)
[00:28:52]               │ debg Find.clickByCssSelector('[data-test-subj="fieldSaveButton"]') with timeout=10000
[00:28:52]               │ debg Find.findByCssSelector('[data-test-subj="fieldSaveButton"]') with timeout=10000
[00:28:52]               │ debg isGlobalLoadingIndicatorVisible
[00:28:52]               │ debg TestSubjects.exists(globalLoadingIndicator)
[00:28:52]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:28:52]               │ERROR browser[SEVERE] http://localhost:61231/api/saved_objects/index-pattern/logstash-* - Failed to load resource: the server responded with a status of 409 (Conflict)
[00:28:52]               │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:28:52]               │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:28:52]               │ERROR browser[SEVERE] http://localhost:61231/api/saved_objects/index-pattern/logstash-* - Failed to load resource: the server responded with a status of 409 (Conflict)
[00:28:52]               │ debg TestSubjects.find(dataGridWrapper > dataGridHeader)
[00:28:52]               │ debg Find.findByCssSelector('[data-test-subj="dataGridWrapper"] [data-test-subj="dataGridHeader"]') with timeout=10000
[00:28:52]               │ info Taking screenshot "/dev/shm/workspace/parallel/23/kibana/test/functional/screenshots/failure/discover app discover integration with runtime fields editor allows adding custom label to existing fields.png"
[00:28:52]               │ info Current URL is: http://localhost:61231/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:%272015-09-19T06:31:44.000Z%27,to:%272015-09-23T18:31:44.000Z%27))&_a=(columns:!(bytes),filters:!(),index:%27logstash-*%27,interval:auto,query:(language:kuery,query:%27%27),sort:!(!(%27@timestamp%27,desc)))
[00:28:52]               │ info Saving page source to: /dev/shm/workspace/parallel/23/kibana/test/functional/failure_debug/html/discover app discover integration with runtime fields editor allows adding custom label to existing fields.html
[00:28:52]               └- ✖ fail: discover app discover integration with runtime fields editor allows adding custom label to existing fields
[00:28:52]               │      Error: expected 'Control column,Select column,Time (@timestamp),bytes' to contain 'megabytes'
[00:28:52]               │       at Assertion.assert (node_modules/@kbn/expect/expect.js:100:11)
[00:28:52]               │       at Assertion.string (node_modules/@kbn/expect/expect.js:442:10)
[00:28:52]               │       at Context.<anonymous> (test/functional/apps/discover/_runtime_fields_editor.ts:56:65)
[00:28:52]               │       at runMicrotasks (<anonymous>)
[00:28:52]               │       at processTicksAndRejections (internal/process/task_queues.js:93:5)
[00:28:52]               │       at Object.apply (node_modules/@kbn/test/src/functional_test_runner/lib/mocha/wrap_function.js:73:16)
[00:28:52]               │ 
[00:28:52]               │ 

Stack Trace

Error: expected 'Control column,Select column,Time (@timestamp),bytes' to contain 'megabytes'
    at Assertion.assert (node_modules/@kbn/expect/expect.js:100:11)
    at Assertion.string (node_modules/@kbn/expect/expect.js:442:10)
    at Context.<anonymous> (test/functional/apps/discover/_runtime_fields_editor.ts:56:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Object.apply (node_modules/@kbn/test/src/functional_test_runner/lib/mocha/wrap_function.js:73:16)

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 789.8KB 789.8KB +81.0B

History

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

@wylieconlon wylieconlon merged commit 5bdcff9 into elastic:master Apr 20, 2021
@wylieconlon wylieconlon deleted the kql-improve-wildcard branch April 20, 2021 16:18
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Apr 20, 2021
* [KQL] Skip slow wildcard checks when query is only *

* Fix case without index pattern

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
wylieconlon pushed a commit that referenced this pull request Apr 21, 2021
* [KQL] Skip slow wildcard checks when query is only *

* Fix case without index pattern

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Apr 21, 2021
* [KQL] Skip slow wildcard checks when query is only *

* Fix case without index pattern

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
wylieconlon pushed a commit that referenced this pull request Apr 21, 2021
* [KQL] Skip slow wildcard checks when query is only *

* Fix case without index pattern

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
lukasolson added a commit that referenced this pull request May 29, 2024
## Summary

The following code was was introduced in
#96902:


https://github.com/elastic/kibana/blob/69b28f317b07af12fa346571b04b411a6130b25f/packages/kbn-es-query/src/kuery/functions/is.ts#L109-L112

As far as I can tell it was really just added to ensure that a contrived
behavior stayed exactly the same after the optimization that PR made. I
thought it was related to the case where we have a query like `*` or
`*:*` (in other words, a query that matches all documents) but we are
already handling that in this code:


https://github.com/elastic/kibana/blob/69b28f317b07af12fa346571b04b411a6130b25f/packages/kbn-es-query/src/kuery/functions/is.ts#L62-L68

As we are moving to a scenario where we expect the field list passed to
this code to be a subset of the entire list of fields (see
#183694), this condition and the
corresponding contrived test are removed in this PR.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants