Dynamic_templates - is path_match on subfield possible?


(seallison) #1

Is it possible to use path_match to consider sub fields as criteria in
applying the template?

For example, I have a dynamic template like this, but it isn't really what
I want:

"dynamic_templates": [
{
"nested_property_attributes": {
"match_mapping_type": "object",
"path_match": "*.value",
"mapping": {
"type": "nested",
"include_in_parent": true
}
}
}
]

In my data, what is under the path *.value could be a lot of different
things. If there is a property named 'ranking' under .value, then I want
to index it as a nested type. Otherwise, I don't want the template applied.

For example: I want the dynamic template to apply to the path
"foo.bar.value" if and only if there is a "foo.bar.value.ranking" field.

Is there any way to express this? Maybe using "match_pattern": "regex" ?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c005b3c7-2fe0-431f-8f0f-cff1fd32b02a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2