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

Add inline template_content support to the opensearch sink #3431

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

graytaylor0
Copy link
Member

@graytaylor0 graytaylor0 commented Oct 3, 2023

Description

Adds a template_content parameter for inline index templates in the OpenSearch sink. This can be used as an alternative to template_file

Issues Resolved

Resolves #3365

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

dlvenable
dlvenable previously approved these changes Oct 5, 2023
}

if (templateContent != null && templateFile != null) {
LOG.warn("Both template_content and template_file are configured. Only template_content will be used");
Copy link
Member

Choose a reason for hiding this comment

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

Was there a particular reason you have the content take precedence over the file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not necessarily but if anything i am figuring the template_content will be more widely used

@@ -480,4 +529,12 @@ private Map<String, Object> initializeConfigMetaData(
}
return metadata;
}

private String getTemplateContent() {
Copy link
Member

Choose a reason for hiding this comment

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

This might be better named createTemplateContent() to avoid signaling that it is a "getter" method.

@sharraj
Copy link

sharraj commented Oct 6, 2023

Can we call it index template to be inline with standard naming --> https://opensearch.org/docs/latest/im-plugin/index-templates/. Like in this API PUT _index_template/ , in pipeline it can be called as index_template

@graytaylor0
Copy link
Member Author

Can we call it index template to be inline with standard naming --> https://opensearch.org/docs/latest/im-plugin/index-templates/. Like in this API PUT _index_template/ , in pipeline it can be called as index_template

The API for v1 templates is PUT _template, which can also be supplied here on template_content

@dlvenable
Copy link
Member

The existing parameters only use the term "template." Also, if you read the OpenSearch documentation, you can see that it continues to use the term "template" for generic templates.

This new Data Prepper parameter allows for configuring the template whether it is an "index template" or a "v1 template." Thus, the term "template" appears to fit well here.

Signed-off-by: Taylor Gray <tylgry@amazon.com>
Signed-off-by: Taylor Gray <tylgry@amazon.com>
@graytaylor0 graytaylor0 merged commit e19ae8f into opensearch-project:main Oct 6, 2023
44 of 45 checks passed
@graytaylor0 graytaylor0 deleted the InlineTemplate branch October 6, 2023 16:17
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.5 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.5 2.5
# Navigate to the new working tree
cd .worktrees/backport-2.5
# Create a new branch
git switch --create backport/backport-3431-to-2.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e19ae8f2302b096363229abad77c1ab5a2042569
# Push it to GitHub
git push --set-upstream origin backport/backport-3431-to-2.5
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.5

Then, create a pull request where the base branch is 2.5 and the compare/head branch is backport/backport-3431-to-2.5.

graytaylor0 added a commit to graytaylor0/data-prepper that referenced this pull request Oct 6, 2023
…h-project#3431)

Signed-off-by: Taylor Gray <tylgry@amazon.com>
(cherry picked from commit e19ae8f)
graytaylor0 added a commit to graytaylor0/data-prepper that referenced this pull request Oct 6, 2023
…h-project#3431)

Signed-off-by: Taylor Gray <tylgry@amazon.com>
(cherry picked from commit e19ae8f)
graytaylor0 added a commit that referenced this pull request Oct 6, 2023
…3453)

Signed-off-by: Taylor Gray <tylgry@amazon.com>
(cherry picked from commit e19ae8f)

Signed-off-by: Taylor Gray <tylgry@amazon.com>
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.

Support inline index templates in OpenSearch sink
4 participants