Skip to content

Commit

Permalink
Clarify that path_match also considers object fields. (#41658)
Browse files Browse the repository at this point in the history
The `path_match` and `path_unmatch` parameters in dynamic templates match on
object fields in addition to leaf fields. This is not obvious and can cause
surprising errors when a template is meant for a leaf field, but there are
object fields that match. This PR adds a note to the docs to describe the
current behavior.
  • Loading branch information
jtibshirani authored May 6, 2019
1 parent ba88616 commit d75d614
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions docs/reference/mapping/dynamic/templates.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,37 @@ PUT my_index
PUT my_index/_doc/1
{
"name": {
"first": "Alice",
"middle": "Mary",
"last": "White"
"first": "John",
"middle": "Winston",
"last": "Lennon"
}
}
--------------------------------------------------
// CONSOLE

Note that the `path_match` and `path_unmatch` parameters match on object paths
in addition to leaf fields. As an example, indexing the following document will
result in an error because the `path_match` setting also matches the object
field `name.title`, which can't be mapped as text:

[source,js]
--------------------------------------------------
PUT my_index/_doc/2
{
"name": {
"first": "Paul",
"last": "McCartney",
"title": {
"value": "Sir",
"category": "order of chivalry"
}
}
}
--------------------------------------------------
// CONSOLE
// TEST[continued]
// TEST[catch:bad_request]

[[template-variables]]
==== `{name}` and `{dynamic_type}`

Expand Down

0 comments on commit d75d614

Please sign in to comment.