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

Mapper: Dynamic Template Support #397

Closed
kimchy opened this issue Oct 1, 2010 · 1 comment
Closed

Mapper: Dynamic Template Support #397

kimchy opened this issue Oct 1, 2010 · 1 comment

Comments

@kimchy
Copy link
Member

kimchy commented Oct 1, 2010

Dynamic templates allow to define mapping templates that will be applied when dynamic introduction of fields / objects happens.

For example, we might want to have all fields to be stored by default, or all string fields to be stored, or have string fields to always be indexed as multi_field once analyzed and once not_analyzed. Here is a simple example:

{
    "person" : {
        "dynamic_templates" : [
            {
                "template_1" : {
                    "match" : "multi*",
                    "mapping" : {
                        "type" : "multi_field",
                        "fields" : {
                            "{name}" : {"type": "{dynamic_tpye}", "index" : "analyzed", "store" : "yes"},
                            "org" : {"type": "{dynamic_type}", "index" : "not_analyzed", "store" : "yes"}
                        }
                    }
                }
            },
            {
                "template_2" : {
                    "match" : "*",
                    "match_mapping_type" : "string",
                    "mapping" : {
                        "type" : "string",
                        "index" : "not_analyzed"
                    }
                }
            }
        ]
    }
}

The above mapping will create a multi_field mapping for all field names starting with multi, and will map all string types to be not_analyzed.

The dynamic_templates section can be placed only on the root object. and it is applied to all inner objects / fields.

Dynamic templates are named to allow for simple merge behavior. A new mapping, just with a new template can be "put" and that template will be added, or if it has the same name, the template will be replaced.

The match allow to define matching on the field name. An unmatch option is also available to exclude fields if they do match on match. The match_mapping_type controls if this template will be applied only for dynamic fields of the specified type (as guessed by the json format).

The format of all the matching is simple format, allowing to use * as a matching element supporting simple patterns such as xxx*, *xxx, xxx*yyy (with arbitrary number of pattern types), as well as direct equality. The match_pattern can be set to regex to allow for regular expression based matching.

The mapping element provides the actual mapping definition. The {name} keyword can be used and will be replaced with the actual dynamic field name being introduced. The {dynamic_type} (or {dynamicType}) can be used and will be replaced with the mapping derived based on the field type (or the derived type, like date).

Complete generic settings can also be applied, for example, to have all mappings be stored, just set:

{
    "person" : {
        "dynamic_templates" : [
            {
                "store_generic" : {
                    "match" : "*",
                    "mapping" : {
                        "store" : "yes"
                    }
                }
            }
        ]
    }
}
@kimchy
Copy link
Member Author

kimchy commented Oct 1, 2010

Mapper: Dynamic Template Support, closed by 99fcfde.

medcl pushed a commit to medcl/elasticsearch that referenced this issue Jul 1, 2011
medcl pushed a commit to medcl/elasticsearch that referenced this issue Jul 1, 2011
tlrx added a commit that referenced this issue Nov 10, 2016
This commit updates JodaTime to version 2.9.5 that contain a fix for a bug when parsing time zones (see JodaOrg/joda-time#332, JodaOrg/joda-time#386 and JodaOrg/joda-time#373).

It also remove the joda-convert dependency that seems to be unused.
    
closes #20911

Here is the changelog for 2.9.5:
```
Changes in 2.9.5
----------------
 - Add Norwegian period translations [#378]

 - Add Duration.dividedBy(long,RoundingMode) [#69, #379]

 - DateTimeZone data updated to version 2016i

 - Fixed bug where clock read twice when comparing two nulls in DateTimeComparator [#404]

 - Fixed minor issues with historic time-zone data [#373]

 - Fix bug in time-zone binary search [#332, #386]
  The fix in v2.9.2 caused problems when the time-zone being parsed
  was not the last element in the input string. New approach uses a
  different approach to the problem.

 - Update tests for JDK 9 [#394]

 - Close buffered reader correctly in zone info compiler [#396]

 - Handle locale correctly zone info compiler [#397]
```
tlrx added a commit that referenced this issue Nov 10, 2016
This commit updates JodaTime to version 2.9.5 that contain a fix for a bug when parsing time zones (see JodaOrg/joda-time#332, JodaOrg/joda-time#386 and JodaOrg/joda-time#373).

It also remove the joda-convert dependency that seems to be unused.

closes #20911

Here is the changelog for 2.9.5:
```
Changes in 2.9.5
----------------
 - Add Norwegian period translations [#378]

 - Add Duration.dividedBy(long,RoundingMode) [#69, #379]

 - DateTimeZone data updated to version 2016i

 - Fixed bug where clock read twice when comparing two nulls in DateTimeComparator [#404]

 - Fixed minor issues with historic time-zone data [#373]

 - Fix bug in time-zone binary search [#332, #386]
  The fix in v2.9.2 caused problems when the time-zone being parsed
  was not the last element in the input string. New approach uses a
  different approach to the problem.

 - Update tests for JDK 9 [#394]

 - Close buffered reader correctly in zone info compiler [#396]

 - Handle locale correctly zone info compiler [#397]
```

(cherry picked from commit 2e53190)
tlrx added a commit that referenced this issue Nov 10, 2016
This commit updates JodaTime to version 2.9.5 that contain a fix for a bug when parsing time zones (see JodaOrg/joda-time#332, JodaOrg/joda-time#386 and JodaOrg/joda-time#373).

It also remove the joda-convert dependency that seems to be unused.

closes #20911

Here is the changelog for 2.9.5:
```
Changes in 2.9.5
----------------
 - Add Norwegian period translations [#378]

 - Add Duration.dividedBy(long,RoundingMode) [#69, #379]

 - DateTimeZone data updated to version 2016i

 - Fixed bug where clock read twice when comparing two nulls in DateTimeComparator [#404]

 - Fixed minor issues with historic time-zone data [#373]

 - Fix bug in time-zone binary search [#332, #386]
  The fix in v2.9.2 caused problems when the time-zone being parsed
  was not the last element in the input string. New approach uses a
  different approach to the problem.

 - Update tests for JDK 9 [#394]

 - Close buffered reader correctly in zone info compiler [#396]

 - Handle locale correctly zone info compiler [#397]
```

(cherry picked from commit 2e53190)
mindw pushed a commit to mindw/elasticsearch that referenced this issue Sep 5, 2022
… request elastic#397)

MPC-4248: export ASG metrics for recorder_instances

* set asg_enabled_metrics for recorder_instances


Approved-by: Gideon Avida
Approved-by: Can Yildiz
costin pushed a commit that referenced this issue Dec 6, 2022
🤖 ESQL: Merge upstream
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant