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

[Ingest] check and create default indices during setup #64809

Merged
merged 7 commits into from
May 5, 2020

Conversation

neptunian
Copy link
Contributor

@neptunian neptunian commented Apr 29, 2020

#62343

  • add function setup endpoint that creates a placeholder index to supress errors that no matching index exists
  • add readFromDocValues property to each index pattern field to prevent apps like Discovery and Management -> Index Patterns -> (index pattern) from creating a new index pattern from the placeholder index and overwriting our entire index pattern (see Index Pattern overwritten when an index exists #65284). The value should be the same as doc_values

Test:

Go to Dashboads and click on a dashboard for system or nginx FIlebeat. Before there could be many notices about no matching idices:

errors

Now you should not see any toast errors:
Screen Shot 2020-04-29 at 1 12 13 PM

This PR does not resolve these errors.
Screen Shot 2020-04-29 at 1 22 01 PM

@neptunian neptunian added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.8.0 Team:Fleet Team label for Observability Data Collection Fleet team labels Apr 29, 2020
@neptunian neptunian requested a review from a team April 29, 2020 17:24
@neptunian neptunian self-assigned this Apr 29, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@neptunian neptunian changed the title check and create default indices during setup [Ingest] check and create default indices during setup Apr 29, 2020
@neptunian
Copy link
Contributor Author

@elasticmachine merge upstream

@@ -356,3 +359,35 @@ const getFieldFormatParams = (field: Field): FieldFormatParams => {
if (field.open_link_in_current_tab) params.openLinkInCurrentTab = field.open_link_in_current_tab;
return params;
};

export const ensureDefaultIndices = async (callCluster: CallESAsCurrentUser) =>
// create a placeholder index to supress errors in the kibana Dashboards app
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
// create a placeholder index to supress errors in the kibana Dashboards app
// create a placeholder indicies to supress errors in the kibana Dashboards app

Could you also add a link here to the open Kibana issue?

@ruflin
Copy link
Member

ruflin commented Apr 30, 2020

I tested this locally and got two errors.

The first one I assume comes from a missing field in the Endpoint package:

Screenshot 2020-04-30 at 10 03 12

This one is about the missing @timestamp field. I wonder if this is solved if we add an @timestamp field with a data to the doc we create?

Screenshot 2020-04-30 at 10 03 41

@neptunian
Copy link
Contributor Author

neptunian commented Apr 30, 2020

@ruflin I'm not creating a documents in this PR, I'm just creating an index. where are you getting the timestamp error?

@ruflin
Copy link
Member

ruflin commented Apr 30, 2020

@neptunian One was the endpoint dashboard, the other one I think was just on discovery page selecting one of the index pattern. I didn't ingest any data.

@neptunian
Copy link
Contributor Author

neptunian commented May 4, 2020

@ruflin it looks like the reason it's getting that @timestamp error is because if I PUT an index, whenever I visit the index patterns in the management page or the Discovery app it will overwrite whatever index pattern already exists (logs-*) with the existing index that's matching it, which in this case is an empty index.

Screen Shot 2020-05-04 at 12 09 44 PM

Same with events. The errors for these fields may be because they were overwritten by the new placeholder index.
Screen Shot 2020-05-04 at 12 34 46 PM

So, even though, during setup, a lot of fields were added to the index pattern due to installation of the default packages, they will be overwritten visiting these pages if no indices exist or they exist with a few fields. They create the patterns automatically.

@neptunian
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

I tested this locally. No errors show up and dashboards seem to still work as expected. I checked 2 system dashboards.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@neptunian neptunian merged commit daceebb into elastic:master May 5, 2020
neptunian added a commit to neptunian/kibana that referenced this pull request May 5, 2020
* check and create default indices during setup

* fix typos

* add kibana issue

* add date mapping

* add removeDocValues to each field to stop apps from creating a new index pattern

* update snapshot

* add property to test data
# Conflicts:
#	x-pack/plugins/ingest_manager/common/constants/epm.ts
neptunian added a commit that referenced this pull request May 6, 2020
* check and create default indices during setup

* fix typos

* add kibana issue

* add date mapping

* add removeDocValues to each field to stop apps from creating a new index pattern

* update snapshot

* add property to test data
# Conflicts:
#	x-pack/plugins/ingest_manager/common/constants/epm.ts

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@jasonrhodes
Copy link
Member

Hey all, I would love to understand more about this and what the plan is to get around this more completely. This change broke some assumptions we were making in the Logs and Metrics apps around when we can assume "logs-" and "metrics-" indices would exist (i.e. their existence should imply the intention to ingest data of that type). Our assumption was a bit flaky, but this change also feel pretty tenuous. Thanks!

@ruflin
Copy link
Member

ruflin commented Jul 27, 2020

@jasonrhodes I think we haven't figured out the final solution yet. The above is kind of a hack but otherwise users see lots of errors because of the way index patterns work today. I would hope we can change the way index patterns work ;-) Happy to sync up if it didn't happen yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants