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

allow specification of a index template #194

Merged
merged 1 commit into from
Sep 12, 2016

Conversation

aerickson
Copy link

@aerickson aerickson commented Aug 26, 2016

Allow users to specify a template to define on connection creation (similar to logstash).

See #33.

  • tests added
  • tests passing
  • README updated (if needed)
  • README Table of Contents updated (if needed)
  • History.md and version in gemspec are untouched
  • backward compatible
  • feature works in elasticsearch_dynamic (not required but recommended)

@coveralls
Copy link

coveralls commented Aug 26, 2016

Coverage Status

Coverage increased (+0.3%) to 95.184% when pulling 5fa9a87 on aerickson:specify_index_template into 0788dfc on uken:master.

@coveralls
Copy link

coveralls commented Aug 30, 2016

Coverage Status

Coverage increased (+0.3%) to 95.184% when pulling 32f301e on aerickson:specify_index_template into 0788dfc on uken:master.

@aerickson
Copy link
Author

@pitr Do you have any comments? I'd love to get this merged. Thanks!

raise "If you specify a template_name you must specify a valid template file (checked '#{@template_file}')!"
end
file_contents = IO.read(@template_file).gsub(/\n/,'')
template = JSON.parse(file_contents)
Copy link
Contributor

Choose a reason for hiding this comment

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

simply leaving last line as JSON.parse(file_contents) is sufficient

@pitr
Copy link
Contributor

pitr commented Sep 8, 2016

Looks good, I left a few comments. Could you also extract all template logic to a separate module.

@aerickson
Copy link
Author

@pitr Thanks for the feedback. Changes made.

I was rescuing the more specific exception earlier when I was testing, but I encountered an error about an undeclared exception class when fluent-plugin-aws-elasticsearch-service consumed fluent-plugin-elasticsearch... but that seems to be gone now (just tested). Not sure what changed. :)

@coveralls
Copy link

coveralls commented Sep 12, 2016

Coverage Status

Coverage increased (+0.3%) to 95.211% when pulling 19d734b on aerickson:specify_index_template into 0788dfc on uken:master.

@pitr pitr merged commit e349304 into uken:master Sep 12, 2016
@pitr
Copy link
Contributor

pitr commented Sep 12, 2016

1.7.0 released with this change. Also, I renamed template code in e87598a since out_*.rb files are for plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants