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

[Index Patterns] Improve handling of the field_caps API request #83448

Closed
kertal opened this issue Nov 16, 2020 · 5 comments
Closed

[Index Patterns] Improve handling of the field_caps API request #83448

kertal opened this issue Nov 16, 2020 · 5 comments
Labels
enhancement New value added to drive a business result Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort

Comments

@kertal
Copy link
Member

kertal commented Nov 16, 2020

Soon an index pattern no longer caches its fields in the saved object, so they will be requested by field_caps API more often (#82223). There is a related problem we've encountered that caused some functional tests to be flaky.

Currently an index pattern is checking, if refreshing the fields cache is necessary. Most of our test fixtures contain legacy field data, so it has to be refreshed. Usually this works, but there were several test failures related to cases when the retrieval of the fieldsAPI didn't work. Here are some details about the last known failure:

https://kibana-ci.elastic.co/job/kibana+flaky-test-suite-runner/971/testReport/junit/Chrome%20UI%20Functional%20Tests/test_functional_apps_discover__filter_editor·js/discover_app_discover_filter_editor_filter_editor_should_add_a_phrases_filter/

The test case failing is using the discover fixture.

await esArchiver.loadIfNeeded('discover');

Its saved object contained legacy fields data (was updated in the meantime):

Bildschirmfoto 2020-11-17 um 09 52 34

This is triggering a request to the field_caps API, here's some logging

http://localhost:61101/37924/bundles/plugin/data/data.plugin.js 0:772727 "API client url" "/api/index_patterns/_fields_for_wildcard"
[00:09:10]               │ debg browser[INFO] http://localhost:61101/37924/bundles/plugin/data/data.plugin.js 0:772761 "API client query" "{\"pattern\":\"logstash-*\",\"meta_fields\":[\"_source\",\"_id\",\"_type\",\"_index\",\"_score\"]}"
[00:09:10]               │ERROR browser[SEVERE] http://localhost:61101/37924/bundles/plugin/data/data.plugin.js 0:772950 "API client Error Message" "Cannot read property 'statusCode' of undefined"
[00:09:10]               │ERROR browser[SEVERE] http://localhost:61101/37924/bundles/plugin/data/data.plugin.js 0:773002 "API client Error" "{}"
[00:09:10]               │ debg browser[INFO] http://localhost:61101/37924/bundles/plugin/data/data.plugin.js 0:594544 "refreshFieldSpecMap ERROR" "{}"

This request failed, there was no valid body returned ("Cannot read property 'statusCode' of undefined). As a result the fields are not updated, and when requesting the data for the Discover histogram @timestamp is missing the aggregatable flag, so it's considered as invalid:

Invalid:
Bildschirmfoto 2020-11-17 um 09 54 03

Valid:
Bildschirmfoto 2020-11-17 um 09 55 45

Bildschirmfoto 2020-11-17 um 09 38 14

To omit this cases the fieldsAPI retrieval should be retried in case of a failure. If it keeps on failing, and there's no valid field cache, it would be good practice to prevent the further usage of this index pattern, until valid fields can be retrieve, to omit confusion by follow up error messages, leading in the wrong direction. Also more logging should be added in case of errors, to provide more information about failing requests.

@kertal kertal added the Feature:Data Views Data Views code and UI - index patterns before 8.0 label Nov 16, 2020
@kertal kertal changed the title [Index Patterns] Improve handling of the fieldsAPI request [Index Patterns] Improve handling of the field_stats API request Nov 17, 2020
@kertal kertal changed the title [Index Patterns] Improve handling of the field_stats API request [Index Patterns] Improve handling of the field_caps API request Nov 17, 2020
@kertal kertal added enhancement New value added to drive a business result Team:AppArch labels Nov 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@mattkime
Copy link
Contributor

I'm going to wait before acting upon this. It seems unlikely to me that this is an index pattern particular problem, rather its either a) something that affects all requests or b) something particular to the field caps api. Also, I'd like to make sure that I'm not solving for a problem that only occurs in CI.

Will keep an eye out for this.

@kertal
Copy link
Member Author

kertal commented Nov 23, 2020

Well, at least it shouldn't be possible to use index patterns with invalid fields, since the follow up error message are confusing. I've seen the misleading error message @ discuss.elastic.co, happened because of an index pattern field update by an external client. This won't be possible in the future, right? But anyway it has to be checked that whatever error happens when fetching fields, the index pattern can't be used (until the data is refetched )

@mattkime
Copy link
Contributor

mattkime commented Nov 23, 2020

But anyway it has to be checked that whatever error happens when fetching fields, the index pattern can't be used (until the data is refetched )

Yes, this will be resolved. A field_caps request failure will result in a thrown error.

@ppisljar
Copy link
Member

ppisljar commented Aug 9, 2022

Thank you for contributing to this issue, however, we are closing this issue due to inactivity as part of a backlog grooming effort. If you believe this feature/bug should still be considered, please reopen with a comment.

@ppisljar ppisljar closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort
Projects
None yet
Development

No branches or pull requests

4 participants