Skip to content

Load index templates v2 by default when talking to ES 7.16 or ES 8.x#28538

Merged
kvch merged 11 commits intoelastic:7.16from
kvch:forward-compatibility-libeat-index-templates-7.x
Oct 21, 2021
Merged

Load index templates v2 by default when talking to ES 7.16 or ES 8.x#28538
kvch merged 11 commits intoelastic:7.16from
kvch:forward-compatibility-libeat-index-templates-7.x

Conversation

@kvch
Copy link
Copy Markdown
Contributor

@kvch kvch commented Oct 19, 2021

What does this PR do?

From now on Beats is going to load the new index templates to Elasticsearch 7.x and 8.x.

The PR consists of a few test fixes, and I had found an issue in templates, that I will port to master.

Why is it important?

This way we can be forward compatible with Elasticsearch 8.x where legacy templates are no longer available.

Checklist

  • My code follows the style guidelines of this project
    - [ ] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

Partially addresses #25018

@kvch kvch requested review from a team as code owners October 19, 2021 16:54
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 19, 2021
@kvch kvch added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Oct 19, 2021
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 19, 2021
@kvch kvch requested a review from ruflin October 19, 2021 16:55
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Oct 19, 2021

💔 Build Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-10-20T16:02:24.362+0000

  • Duration: 163 min 6 sec

  • Commit: 178a273

Test stats 🧪

Test Results
Failed 0
Passed 54575
Skipped 5292
Total 59867

Steps errors 4

Expand to view the steps failures

filebeat-pythonIntegTest - mage pythonIntegTest
  • Took 13 min 37 sec . View more details here
  • Description: mage pythonIntegTest
Build a job
  • Took 0 min 0 sec . View more details here
gsutil -m -q cp -a public-read build/system-tests-*.tar.gz gs://beats-ci-temp/Beats/beats/PR-28538-9
  • Took 0 min 2 sec . View more details here
  • Description: gsutil -m -q cp -a public-read build/system-tests-*.tar.gz gs://beats-ci-temp/Beats/beats/PR-28538-9
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Error 'co.elastic.BuildException'

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

Copy link
Copy Markdown
Contributor

@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.

The change LGTM, CI does not seem to be too happy. The nice part about this change is that even though it is in theory a breaking change, I expect very few users will even notice. Some users will notice that try to ship data to <7.8 but these have the option to turn on legacy again if my understanding here is correct.

@nimarezainia Heads up on this slightly breaking change for 7.16 but it needs to be done to have a smooth migration to 8.

- Fix panic with inline SSL when the certificate or key were small than 256 bytes. {pull}23820[23820]
- Skip add_kubernetes_metadata processor when kubernetes metadata are already present {pull}27689[27689]
- Enable IMDSv2 support for `add_cloud_metadata` processor on AWS. {issue}22101[22101] {pull}28285[28285]
- Load index templates v2 by default when talking to ES 7.16 or ES 8.x {pull}28538[28538]
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.

Can we add a note here that it also means template can only be loaded for Elasticsearch versions newer 7.8 (I think that is when the index templates were introduced).

@andresrc andresrc changed the base branch from 7.x to 7.16 October 20, 2021 12:54
@andresrc
Copy link
Copy Markdown
Contributor

@kvch I have moved this PR's base to 7.16

@kvch
Copy link
Copy Markdown
Contributor Author

kvch commented Oct 20, 2021

jenkins run tests

@nimarezainia
Copy link
Copy Markdown
Contributor

@ruflin & @kvch Would you be able to describe the conditions under which this would break in 7.16? thx

@ruflin
Copy link
Copy Markdown
Contributor

ruflin commented Oct 26, 2021

Lets assume we have a user using Metricbeat 7.15 shipping data to Elasticsearch 7.5. The user never modified the template settings and because of this uses the defaults. Now the user upgrades to 7.16 and metricbeat tries to setup the template. But it will fail because 7.5 does not support this type of templates yet. The user will have to modify the setting to legacy to keep things working.

kvch added a commit to kvch/beats that referenced this pull request Oct 28, 2021
…lastic#28538)

## What does this PR do?

From now on Beats is going to load the new index templates to Elasticsearch 7.x and 8.x.

The PR consists of a few test fixes, and I had found an issue in templates, that I will port to master.

## Why is it important?

This way we can be forward compatible with Elasticsearch 8.x where legacy templates are no longer available.
@nimarezainia
Copy link
Copy Markdown
Contributor

@andresrc @jlind23 is there a way we mark issues that need to be mentioned in our release notes?

@uvNikita
Copy link
Copy Markdown

uvNikita commented Dec 9, 2021

Is there any reason why new templates couldn't also be marked as a data stream?

@kvch
Copy link
Copy Markdown
Contributor Author

kvch commented Dec 17, 2021

ILM works slightly differently when using data streams. Data streams provide a name to access all of your data and the backing indices are managed by ILM. In 7.16 and before Beats loads and alias and uses it as a write index alias. We needed a bit more time to address those changes. Furthermore, we wanted to somewhat ease the transition from composable indices to data streams.

If you want to use data streams in 7.16, you can just convert the alias loaded by Beats to a data stream by following the instructions of this section: https://www.elastic.co/guide/en/elasticsearch/reference/master/set-up-a-data-stream.html#convert-index-alias-to-data-stream Do not forget to disable ILM loading afterwards.

Beats has no trouble sending to data streams. Just be careful to only use "create" operation when you are sending events (this is the default in Beats), and always have a @timestamp field (also default in Beats).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants