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

Replace action.auto_create_index with a template setting #20640

Closed
clintongormley opened this issue Sep 23, 2016 · 3 comments · Fixed by #61858
Closed

Replace action.auto_create_index with a template setting #20640

clintongormley opened this issue Sep 23, 2016 · 3 comments · Fixed by #61858
Assignees
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >feature help wanted adoptme Team:Data Management Meta label for data/management team

Comments

@clintongormley
Copy link

In #9359 we discussed the possibility of extending the action.auto_create_index setting to automatically recognise index names which match templates, and to allow those to be auto-created without having to maintain both the template and the setting.

In FixitFriday we came up with a better solution:

  • Remove the action.auto_create_index setting
  • Add an auto_create_index setting to index templates - if true, then an index can be auto-created
  • Ship with a default match * index with auto_create_index: true - this can be overridden by the user
  • If multiple templates match, the auto_create_index setting is merged just like all other template settings - the highest order wins

When upgrading, the user will see an exception if they set action.auto_create_index and will need to update their templates to reflect the same logic.

Possibly, we could add a deprecation period where the action.auto_create_index setting continues to work, but also accepts a _template value which switches to use the template-based logic instead.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jamshid
Copy link

jamshid commented Apr 8, 2020

This would be a great feature, any chance?
I want the convenience of automatically creating an index but only if the cluster has the template defining the settings and schema that my application needs.

@gwbrown
Copy link
Contributor

gwbrown commented Jul 27, 2020

We discussed #56369 in today's Fix-It meeting, and came to the conclusion that the proposal in this issue is closer to what we want to do that the one described in #56369.

There are some new considerations, however. In particular, the suggestion of a wildcard template ("index_patterns" : ["*"]) with the setting to allow auto-creation as a means of backwards compatibility is not possible with the new component/composable templates. Because of this, the latest thinking on this is that we should implement a flag for component/composable templates which overrides action.auto_create_index. This way, most cases will continue to use the behavior of action.auto_create_index, but we can ensure that our internal indices will be able to be auto-created as necessary.

With this proposal, we have the option of deprecating and removing action.auto_create_index, but per our discussion today we are likely to allow them to coexist, with the index template flag overriding action.auto_create_index.

pugnascotia added a commit that referenced this issue Oct 26, 2020
Closes #20640.

This PR introduces a new parameter to v2 templates, `allow_auto_create`,
which allows templates to override the cluster setting `auto_create_index`.
Notes:

   * `AutoCreateIndex` now looks for a matching v2 template, and if its
     `allow_auto_create` setting is true, it overrides the usual logic.
   * `TransportBulkAction` previously used `AutoCreateIndex` to check
     whether missing indices should be created. We now rely on
     `AutoCreateAction`, which was already differentiating between creating
     indices and creating data streams.  I've updated `AutoCreateAction` to
     use `AutoCreateIndex`. Data streams are also influenced by
     `allow_auto_create`, in that their default auto-create behaviour can
     be disabled with this setting.
   * Most of the Java file changes are due to introducing an extra
     constructor parameter to `ComposableIndexTemplate`.
   * I've added the new setting to various x-pack templates
   * I added a YAML test to check that watches can be created even when
     `auto_create_index` is `false`.
pugnascotia added a commit to pugnascotia/elasticsearch that referenced this issue Oct 27, 2020
…#61858)

Closes elastic#20640.

This PR introduces a new parameter to v2 templates, `allow_auto_create`,
which allows templates to override the cluster setting `auto_create_index`.
Notes:

   * `AutoCreateIndex` now looks for a matching v2 template, and if its
     `allow_auto_create` setting is true, it overrides the usual logic.
   * `TransportBulkAction` previously used `AutoCreateIndex` to check
     whether missing indices should be created. We now rely on
     `AutoCreateAction`, which was already differentiating between creating
     indices and creating data streams.  I've updated `AutoCreateAction` to
     use `AutoCreateIndex`. Data streams are also influenced by
     `allow_auto_create`, in that their default auto-create behaviour can
     be disabled with this setting.
   * Most of the Java file changes are due to introducing an extra
     constructor parameter to `ComposableIndexTemplate`.
   * I've added the new setting to various x-pack templates
   * I added a YAML test to check that watches can be created even when
     `auto_create_index` is `false`.
pugnascotia added a commit that referenced this issue Nov 5, 2020
Backport of #61858.

Closes #20640.

This PR introduces a new parameter to v2 templates, `allow_auto_create`,
which allows templates to override the cluster setting `auto_create_index`.
Notes:

   * `AutoCreateIndex` now looks for a matching v2 template, and if its
     `allow_auto_create` setting is true, it overrides the usual logic.
   * `TransportBulkAction` previously used `AutoCreateIndex` to check
     whether missing indices should be created. We now rely on
     `AutoCreateAction`, which was already differentiating between creating
     indices and creating data streams.  I've updated `AutoCreateAction` to
     use `AutoCreateIndex`. Data streams are also influenced by
     `allow_auto_create`, in that their default auto-create behaviour can
     be disabled with this setting.
   * Most of the Java file changes are due to introducing an extra
     constructor parameter to `ComposableIndexTemplate`.
   * I've added the new setting to various x-pack templates
   * I added a YAML test to check that watches can be created even when
     `auto_create_index` is `false`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >feature help wanted adoptme Team:Data Management Meta label for data/management team
Projects
None yet
8 participants