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

Extend dynamic templates to make them define runtime fields (#66112) #66156

Merged
merged 5 commits into from
Dec 10, 2020

Conversation

javanna
Copy link
Member

@javanna javanna commented Dec 10, 2020

Runtime fields are defined as part of the runtime section in the mappings. Dynamic templates allow to specify mappings for fields that are getting automatically created. With this change, we allow users to create dynamic under the runtime section, and optionally define their mappings.

The following is an example of dynamic template that matches any incoming long field as runtime field, meaning they will all be evaluated at runtime. When a script is not specified, runtime fields are loaded from a field with the same name in _source.

{
  "mappings": {
    "dynamic_templates": [
      {
        "long_as_runtime": {
          "match_mapping_type": "long",
          "runtime": {

          }
        }
      }
    ]
  }
}

Backport of #66112

…66112)

Runtime fields are defined as part of the runtime section in the mappings. Dynamic templates allow to specify mappings for fields that are getting automatically created. With this change, we allow users to create dynamic under the runtime section, and optionally define their mappings.

The following is an example of dynamic template that matches any incoming long field as runtime field, meaning they will all be evaluated at runtime. When a script is not specified, runtime fields are loaded from a field with the same name in _source.

```
{
  "mappings": {
    "dynamic_templates": [
      {
        "long_as_runtime": {
          "match_mapping_type": "long",
          "runtime": {

          }
        }
      }
    ]
  }
}
```
javanna added a commit to javanna/elasticsearch that referenced this pull request Dec 10, 2020
As part of elastic#66156 the validation of dynamic templates has been adapted to support runtime fields. As part of that change, a `break` was forgotten, which causes needless additional validation rounds after a template has been already successfully validated against one of the field types.
@javanna
Copy link
Member Author

javanna commented Dec 10, 2020

run elasticsearch-ci/bwc

javanna added a commit that referenced this pull request Dec 10, 2020
As part of #66156 the validation of dynamic templates has been adapted to support runtime fields. As part of that change, a `break` was forgotten, which causes needless additional validation rounds after a template has been already successfully validated against one of the field types.
@javanna javanna merged commit 3882653 into elastic:7.x Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant