-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Recursive path_match in dynamic template does not work for trailing * #32595
Comments
Pinging @elastic/es-search-aggs |
The trailing |
I now understand the reasoning behind how this works. However, the documentation is very vague on exactly how the |
I see how confusing this can be so I am reopening this issue to clarify the docs. |
Closing now that the docs have been updated in #41658. |
@jimczi @jtibshirani do you have a solution to Thanks |
@eddycharly in this issue we only documented the existing behavior, but didn't make plans to change or enhance the behavior. Would you be able to file a new 'enhancement request' issue? You could describe your use case, including an example of your mappings. |
@jtibshirani i found a possible solution that seems to work. Just wanted to know if there was a valid approach to implement the use case described here. |
Got it. To clarify, currently there's no dedicated way to ensure |
The solution that seems to work: "mappings" : {
"dynamic_templates" : [
{
"strings_as_keywords" : {
"mapping" : {
"type" : "keyword"
},
"match_mapping_type" : "string"
}
},
{
"context_objects_as_objects" : {
"path_match": "context.*",
"match_mapping_type": "object",
"mapping" : {
"type": "{dynamic_type}"
}
}
},
{
"context_as_keyword" : {
"path_match": "context.*",
"mapping" : {
"type" : "keyword"
}
}
}
]
} Basically if it matches an object, it keeps the object (this is not a leaf node), else it uses a keyword (for leaf nodes). What do you think ? Are there some cases where it would not work ? |
@eddycharly apologies, I misunderstood your earlier comment and thought you were suggesting an enhancement/ feature. That approach seems like it would work to me. If the goal is just to handle this We try to reserve GitHub for discussions about bugs or feature development, as opposed to usage questions. If you have more questions, I suggest we hop over to the Elastic forums to continue the discussion. |
|
Elasticsearch version: 6.2.4
Plugins installed: []
JVM version: 1.8.0_172
OS version: MacOS (Darwin Kernel Version 15.6.0)
Description of the problem including expected versus actual behavior:
Returns the following error:
However, if you replace the path_match in the dynamic template to
prop1.prop2.*.field
, it works as expected and matchesprop1.prop2.prop3.prop4.field
.The text was updated successfully, but these errors were encountered: